summaryrefslogtreecommitdiff
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
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.
-rw-r--r--ChangeLog3
-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
6 files changed, 20 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 71b1c5bb..d34784e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,9 @@
src/game-server/accountconnection.cpp, src/game-server/gamehandler.cpp:
Changed singleton managers from classes to namespace interfaces.
Removed global pointers. Moved private members to implementation files.
+ * src/game-server/state.cpp, src/game-server/being.cpp,
+ src/game-server/movingobject.cpp, src/game-server/movingobject.hpp:
+ Fixed teleportation hack caused by caching of pathfinder results.
2007-07-03 Guillaume Melquiond <guillaume.melquiond@gmail.com>
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. */