summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-03-15 23:32:19 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-03-15 23:32:19 +0100
commit001b6f0f7db78bf7987e302a085b9d8469d59f68 (patch)
treedec89f55b89cca99a245d6bb03d5c67a23a6dc62
parent29259f72663e0eb1820b4d4a0f018acef61bfb2c (diff)
downloadmana-client-001b6f0f7db78bf7987e302a085b9d8469d59f68.tar.gz
mana-client-001b6f0f7db78bf7987e302a085b9d8469d59f68.tar.bz2
mana-client-001b6f0f7db78bf7987e302a085b9d8469d59f68.tar.xz
mana-client-001b6f0f7db78bf7987e302a085b9d8469d59f68.zip
Adapted the Being::logic() to handle very slow beings.
This fixes the bug about monsters direction not being updated. The good news is that the bug was also present for Manaserv and is now corrected. I also moved back the ActorSprite::logic() call at its initial place.
-rw-r--r--src/being.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/being.cpp b/src/being.cpp
index b79b65b3..465cb088 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -673,8 +673,6 @@ void Being::logic()
mText = 0;
}
- ActorSprite::logic();
-
if ((mAction != DEAD) && !mSpeedPixelsPerTick.isNull())
{
const Vector dest = (mPath.empty()) ?
@@ -732,8 +730,10 @@ void Being::logic()
// Update the player sprite direction.
// N.B.: We only change this if the distance is more than one pixel
- // to avoid flawing the ending direction.
- if (distance > 1.0f)
+ // to avoid flawing the ending direction,
+ // or More than the speed in pixel per ticks for very slow beings.
+ float maxDistance = mSpeedPixelsPerTick.length();
+ if (distance > (maxDistance < 1.0f) ? maxDistance : 1.0f)
{
// The player direction is handled for keyboard
// by LocalPlayer::startWalking(), we shouldn't get
@@ -770,6 +770,8 @@ void Being::logic()
}
}
+ ActorSprite::logic();
+
// Remove it after 3 secs. TODO: Just play the dead animation before removing
if (!isAlive() && Net::getGameHandler()->removeDeadBeings() &&
get_elapsed_time(mActionTime) > 3000)