Fixed minor glitch where I would calculate cheapest task too often.

This commit is contained in:
2017-11-26 18:20:23 -08:00
parent e44ec0ee5b
commit edd769b151
1 changed files with 14 additions and 4 deletions

View File

@ -11,16 +11,16 @@ 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,10 +59,20 @@ 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()
{ {
ModCore.CoreMonitor.Log(taskList.Count.ToString()); ModCore.CoreMonitor.Log(taskList.Count.ToString());