Only remove planned tasks

This commit is contained in:
FlightControl 2017-05-24 12:07:49 +02:00
parent 89371378b7
commit 0702057f47

View File

@ -309,7 +309,9 @@ do -- TASK_A2A_DISPATCHER
local TaskReport = REPORT:New()
-- Checking the task queue for the dispatcher, and removing any obsolete task!
for TaskIndex, Task in pairs( self.Tasks ) do
for TaskIndex, TaskData in pairs( self.Tasks ) do
local Task = TaskData -- Tasking.Task#TASK
if Task:IsStatePlanned() then
local DetectedItem = Detection:GetDetectedItem( TaskIndex )
if not DetectedItem then
local TaskText = Task:GetName()
@ -320,6 +322,7 @@ do -- TASK_A2A_DISPATCHER
self.Tasks[TaskIndex] = nil
end
end
end
-- Now that all obsolete tasks are removed, loop through the detected targets.
for DetectedItemID, DetectedItem in pairs( Detection:GetDetectedItems() ) do