From af1ce69940a9c0b46907402e7d69e6ac9ea96912 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Fri, 2 Mar 2007 23:30:17 +0000 Subject: Implemented being death, removal of dead mobs and sitting. --- src/controller.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/controller.cpp') 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(); +} -- cgit v1.2.3-70-g09d2