summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-07 19:21:10 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-07 19:21:10 +0000
commita4c7586b310a8be8ffd5c8acad88b5236695c1da (patch)
tree87af31a35a0b20326109725de88e60a8f25a5bbd /src
parentd213cdea38ae5dda3c1cbdc6c85a2c5fe04e9399 (diff)
downloadmanaserv-a4c7586b310a8be8ffd5c8acad88b5236695c1da.tar.gz
manaserv-a4c7586b310a8be8ffd5c8acad88b5236695c1da.tar.bz2
manaserv-a4c7586b310a8be8ffd5c8acad88b5236695c1da.tar.xz
manaserv-a4c7586b310a8be8ffd5c8acad88b5236695c1da.zip
Fixed teleportation hack caused by caching of pathfinder results.
Diffstat (limited to 'src')
-rw-r--r--src/game-server/being.cpp2
-rw-r--r--src/game-server/movingobject.cpp7
-rw-r--r--src/game-server/movingobject.hpp13
-rw-r--r--src/game-server/spawnarea.cpp1
-rw-r--r--src/game-server/state.cpp1
5 files changed, 17 insertions, 7 deletions
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp
index 5bb608c6..59f37a88 100644
--- a/src/game-server/being.cpp
+++ b/src/game-server/being.cpp
@@ -91,7 +91,7 @@ void Being::die()
LOG_INFO("Being " << getPublicID() << " died");
setAction(DEAD);
// dead beings stay where they are
- setDestination(getPosition());
+ clearDestination();
// Notify death listeners
DeathListeners::iterator i_end = mDeathListeners.end();
diff --git a/src/game-server/movingobject.cpp b/src/game-server/movingobject.cpp
index 2375c903..a24e1070 100644
--- a/src/game-server/movingobject.cpp
+++ b/src/game-server/movingobject.cpp
@@ -24,6 +24,13 @@
#include "game-server/mapcomposite.hpp"
#include "game-server/movingobject.hpp"
+void MovingObject::setDestination(Point const &dst)
+{
+ mDst = dst;
+ raiseUpdateFlags(UPDATEFLAG_NEW_DESTINATION);
+ mPath.clear();
+}
+
void MovingObject::move()
{
mOld = getPosition();
diff --git a/src/game-server/movingobject.hpp b/src/game-server/movingobject.hpp
index 48900863..b1f4a33a 100644
--- a/src/game-server/movingobject.hpp
+++ b/src/game-server/movingobject.hpp
@@ -54,12 +54,13 @@ class MovingObject : public Object
/**
* Sets the destination coordinates of the object.
*/
- void setDestination(const Point &dst)
- {
- mDst = dst;
- raiseUpdateFlags(UPDATEFLAG_NEW_DESTINATION);
- mPath.clear();
- }
+ void setDestination(const Point &dst);
+
+ /**
+ * Sets the destination coordinates of the object to the current position.
+ */
+ void clearDestination()
+ { setDestination(getPosition()); }
/**
* Gets the old coordinates of the object.
diff --git a/src/game-server/spawnarea.cpp b/src/game-server/spawnarea.cpp
index c9d53e04..951b2085 100644
--- a/src/game-server/spawnarea.cpp
+++ b/src/game-server/spawnarea.cpp
@@ -78,6 +78,7 @@ SpawnArea::update()
being->setMap(map);
being->setPosition(position);
+ being->clearDestination();
DelayedEvent e = { EVENT_INSERT };
GameState::enqueueEvent(being, e);
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index b1095f45..7ade4d1b 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -356,6 +356,7 @@ void GameState::update()
assert(o->getType() == OBJECT_CHARACTER);
Character *p = static_cast< Character * >(o);
+ p->clearDestination();
/* Force update of persistent data on map change, so that
characters can respawn at the start of the map after a death or
a disconnection. */