Fixed minor glitch where I would calculate cheapest task too often.
This commit is contained in:
parent
e44ec0ee5b
commit
edd769b151
|
@ -12,15 +12,15 @@ namespace StarAI.ExecutionCore
|
||||||
public static List<CustomTask> taskList = new List<CustomTask>();
|
public static List<CustomTask> taskList = new List<CustomTask>();
|
||||||
public static Task executioner = new Task(new Action(runTaskList));
|
public static Task executioner = new Task(new Action(runTaskList));
|
||||||
|
|
||||||
|
public static List<CustomTask> removalList = new List<CustomTask>();
|
||||||
public static void runTaskList()
|
public static void runTaskList()
|
||||||
{
|
{
|
||||||
|
|
||||||
//myTask t = new myTask(StarAI.PathFindingCore.CropLogic.CropLogic.harvestSingleCrop);
|
//myTask t = new myTask(StarAI.PathFindingCore.CropLogic.CropLogic.harvestSingleCrop);
|
||||||
|
|
||||||
List<CustomTask> removalList = new List<CustomTask>();
|
|
||||||
bool assignNewTask = true;
|
bool assignNewTask = true;
|
||||||
|
|
||||||
foreach(var task in taskList)
|
while(ranAllTasks()==false)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,8 +59,18 @@ namespace StarAI.ExecutionCore
|
||||||
|
|
||||||
|
|
||||||
taskList.Clear();
|
taskList.Clear();
|
||||||
|
removalList.Clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool ranAllTasks()
|
||||||
|
{
|
||||||
|
foreach(CustomTask task in taskList)
|
||||||
|
{
|
||||||
|
if (removalList.Contains(task)) continue;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void printAllTaskMetaData()
|
public static void printAllTaskMetaData()
|
||||||
|
|
Loading…
Reference in New Issue