From dbe6697f1611f2dff31fecbaf973c1d22c922b39 Mon Sep 17 00:00:00 2001 From: Jammyjamjamman Date: Wed, 21 Feb 2018 02:17:48 +0000 Subject: [PATCH] Unit task no longer resets when a different task in a queue is cancelled, fixes bug #67. --- source/glest_game/type_instances/unit.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 3f50705ee..79afbbb32 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -2744,10 +2744,7 @@ namespace Glest { changedActiveCommand = false; retryCurrCommandCount = 0; - // Reset the progress if the command (possibly a task) is cancelled. - /// TODO: this is not an optimal solution because progress is reset even if the task does not track progression - /// e.g. production/ upgrades keep track of progression but walking/ attacking does not. - resetProgress2 (); + this->setCurrentUnitTitle (""); //is empty? @@ -2773,6 +2770,10 @@ namespace Glest delete commands.back (); commands.pop_back (); + // Reset the progress if the last task in the queue was cancelled. + /// TODO: extra if statement needed adding to fix this bug. Can this be avoided? + if (commands.empty()) resetProgress2(); + safeMutex.ReleaseLock (); //clear routes