This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit 2770ee8927cb91419b1918f46228435026790cf6
Author: krzys-h <krzy...@interia.pl>
Date:   Tue Oct 7 21:40:51 2014 +0200

    Fixed issue #324
---
 data                 |  2 +-
 src/object/brain.cpp | 16 ++++++++++++++--
 src/object/brain.h   |  1 +
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/data b/data
index a521070..559797f 160000
--- a/data
+++ b/data
@@ -1 +1 @@
-Subproject commit a521070bb17737e1d3990ba09d09d036749635ab
+Subproject commit 559797f35b88a2d5e882119034923b2ab75817e2
diff --git a/src/object/brain.cpp b/src/object/brain.cpp
index ca578ba..01f20f9 100644
--- a/src/object/brain.cpp
+++ b/src/object/brain.cpp
@@ -820,6 +820,18 @@ void CBrain::StopTask()
     }
 }
 
+// Stops the current secondary task.
+
+void CBrain::StopSecondaryTask()
+{
+    if (m_secondaryTask != nullptr)
+    {
+        m_secondaryTask->Abort();
+        delete m_secondaryTask;  // stops the current secondary task
+        m_secondaryTask = nullptr;
+    }
+}
+
 
 // Introduces a virus into a program.
 // Returns true if it was inserted.
@@ -1000,7 +1012,7 @@ Error CBrain::StartTaskRecover()
 
 Error CBrain::StartTaskShield(TaskShieldMode mode)
 {
-    StopTask();
+    StopSecondaryTask();
 
     m_secondaryTask = new CTaskManager(m_object);
     Error err = m_secondaryTask->StartTaskShield(mode, 1000.0f);
@@ -1048,7 +1060,7 @@ Error CBrain::StartTaskFireAnt(Math::Vector impact)
 
 Error CBrain::StartTaskGunGoal(float dirV, float dirH)
 {
-    StopTask();
+    StopSecondaryTask();
 
     m_secondaryTask = new CTaskManager(m_object);
     Error err = m_secondaryTask->StartTaskGunGoal(dirV, dirH);
diff --git a/src/object/brain.h b/src/object/brain.h
index 8a6b13e..6b0d790 100644
--- a/src/object/brain.h
+++ b/src/object/brain.h
@@ -102,6 +102,7 @@ public:
     int         GetProgram();
     void        StopProgram();
     void        StopTask();
+    void        StopSecondaryTask();
 
     bool        IntroduceVirus();
     void        SetActiveVirus(bool bActive);

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/colobot.git

_______________________________________________
Pkg-games-commits mailing list
Pkg-games-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to