From edd769b151d52a52b031507294744923ccf2b961 Mon Sep 17 00:00:00 2001 From: Date: Sun, 26 Nov 2017 18:20:23 -0800 Subject: [PATCH] Fixed minor glitch where I would calculate cheapest task too often. --- StarAI/StarAI/StarAI/ExecutionCore/TaskList.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/StarAI/StarAI/StarAI/ExecutionCore/TaskList.cs b/StarAI/StarAI/StarAI/ExecutionCore/TaskList.cs index 8e5abebd..3dba0aec 100644 --- a/StarAI/StarAI/StarAI/ExecutionCore/TaskList.cs +++ b/StarAI/StarAI/StarAI/ExecutionCore/TaskList.cs @@ -11,16 +11,16 @@ namespace StarAI.ExecutionCore { public static List taskList = new List(); public static Task executioner = new Task(new Action(runTaskList)); - + + public static List removalList = new List(); public static void runTaskList() { //myTask t = new myTask(StarAI.PathFindingCore.CropLogic.CropLogic.harvestSingleCrop); - List removalList = new List(); bool assignNewTask = true; - foreach(var task in taskList) + while(ranAllTasks()==false) { @@ -59,10 +59,20 @@ namespace StarAI.ExecutionCore 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() { ModCore.CoreMonitor.Log(taskList.Count.ToString());