diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-04-15 23:11:20 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-10-19 22:25:18 +0200 |
commit | 943fdc0eb7237790a469a81fba4c914f9e085977 (patch) | |
tree | b6dd05d307c078d48660f8c38a507a47c106bb43 /src | |
parent | ae8a5ce84a80381eb862468091154c2cc7c60124 (diff) | |
download | manaserv-943fdc0eb7237790a469a81fba4c914f9e085977.tar.gz manaserv-943fdc0eb7237790a469a81fba4c914f9e085977.tar.bz2 manaserv-943fdc0eb7237790a469a81fba4c914f9e085977.tar.xz manaserv-943fdc0eb7237790a469a81fba4c914f9e085977.zip |
Removed inappropriate assignment to mOld in Being::findPath
Being::findPath doesn't change the position of a being, and so should
not be syncing mOld to the current position. When invoked on the wrong
moment, this could cause MapComposite::update to fail to realize that a
being has moved into another zone.
Also removed some other usages of mOld that were not necessary, to make
its purpose clearer and make a potential cleanup easier.
Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src')
-rw-r--r-- | src/game-server/being.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index 4058a4ad..fd9f8fe4 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -192,11 +192,11 @@ void Being::setDestination(const Point &dst) Path Being::findPath() { - mOld = getPosition(); Map *map = getMap()->getMap(); int tileWidth = map->getTileWidth(); int tileHeight = map->getTileHeight(); - int startX = mOld.x / tileWidth, startY = mOld.y / tileHeight; + int startX = getPosition().x / tileWidth; + int startY = getPosition().y / tileHeight; int destX = mDst.x / tileWidth, destY = mDst.y / tileHeight; return map->findPath(startX, startY, destX, destY, getWalkMask()); @@ -307,8 +307,10 @@ void Being::move() Map *map = getMap()->getMap(); int tileWidth = map->getTileWidth(); int tileHeight = map->getTileHeight(); - int tileSX = mOld.x / tileWidth, tileSY = mOld.y / tileHeight; - int tileDX = mDst.x / tileWidth, tileDY = mDst.y / tileHeight; + int tileSX = getPosition().x / tileWidth; + int tileSY = getPosition().y / tileHeight; + int tileDX = mDst.x / tileWidth; + int tileDY = mDst.y / tileHeight; if (tileSX == tileDX && tileSY == tileDY) { @@ -316,7 +318,7 @@ void Being::move() setAction(STAND); // Moving while staying on the same tile is free // We only update the direction in that case. - updateDirection(mOld, mDst); + updateDirection(getPosition(), mDst); setPosition(mDst); mMoveTime = 0; return; |