summaryrefslogtreecommitdiff
path: root/src/controller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/controller.cpp')
-rw-r--r--src/controller.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/controller.cpp b/src/controller.cpp
index a243006c..42a64b66 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -31,16 +31,29 @@ void Controlled::update()
*/
if (mCountDown == 0)
{
- Point randomPos = { rand() % 320 + 720,
- rand() % 320 + 840 };
- setDestination(randomPos);
- mCountDown = 10 + rand() % 10;
+ if (mAction != DEAD)
+ {
+ Point randomPos = { rand() % 320 + 720,
+ rand() % 320 + 840 };
+ setDestination(randomPos);
+ mCountDown = 10 + rand() % 10;
- LOG_DEBUG("Setting new random destination " << randomPos.x << ","
- << randomPos.y << " for being " << getPublicID());
+ LOG_DEBUG("Setting new random destination " << randomPos.x << ","
+ << randomPos.y << " for being " << getPublicID());
+ }
+ else
+ {
+ raiseUpdateFlags(UPDATEFLAG_REMOVE);
+ }
}
else
{
mCountDown--;
}
}
+
+void Controlled::die()
+{
+ mCountDown = 600;
+ Being::die();
+}