summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-09-02 18:54:18 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-09-02 18:54:18 +0000
commit9d135fcce32ee20dd46fb7288c61ef8fef4651b2 (patch)
tree59ace4313112a3f714d7cb7760a1bfb4c8852a87
parent8fe0239f5a369b63c43345e5078a52dbbe98dd9d (diff)
downloadmanaserv-9d135fcce32ee20dd46fb7288c61ef8fef4651b2.tar.gz
manaserv-9d135fcce32ee20dd46fb7288c61ef8fef4651b2.tar.bz2
manaserv-9d135fcce32ee20dd46fb7288c61ef8fef4651b2.tar.xz
manaserv-9d135fcce32ee20dd46fb7288c61ef8fef4651b2.zip
Correctly account time for moving objects.
-rw-r--r--src/object.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/object.cpp b/src/object.cpp
index 038a53dc..f94b5ace 100644
--- a/src/object.cpp
+++ b/src/object.cpp
@@ -45,6 +45,7 @@ void MovingObject::move()
if (path.empty()) {
// no path was found
mDst = mOld;
+ mActionTime = 0;
return;
}
// last tile center is skipped
@@ -58,8 +59,8 @@ void MovingObject::move()
if (path.empty())
{
// skip last tile center
- setPosition(mDst);
- return;
+ pos = mDst;
+ break;
}
pos.x = path.front().x * 32 + 16;
pos.y = path.front().y * 32 + 16;
@@ -67,4 +68,6 @@ void MovingObject::move()
}
while (mActionTime < 100);
setPosition(pos);
+
+ mActionTime = mActionTime > 100 ? mActionTime - 100 : 0;
}