diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-06-08 23:05:15 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-06-08 23:05:15 +0200 |
commit | 32457dd5b2f9431d4f5d503dc8b090a9c1b7f944 (patch) | |
tree | 6bd51d372ea21a4d774a024aa7be49e9aee74fb8 | |
parent | 2b2b02df79649beed9a49e37f21db996f053d4ca (diff) | |
download | mana-32457dd5b2f9431d4f5d503dc8b090a9c1b7f944.tar.gz mana-32457dd5b2f9431d4f5d503dc8b090a9c1b7f944.tar.bz2 mana-32457dd5b2f9431d4f5d503dc8b090a9c1b7f944.tar.xz mana-32457dd5b2f9431d4f5d503dc8b090a9c1b7f944.zip |
Fixed the problem where the player would skip corners
Skipping corners is only allowed around other beings (you can even walk
through them), but not for collision tiles. The server doesn't allow
this, so allowing it client-side leads to synchronization problems.
Mantis-issue: 730
-rw-r--r-- | src/map.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/map.cpp b/src/map.cpp index 490e52c1..0b1550db 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -475,7 +475,8 @@ const std::string &Map::getName() const static int const basicCost = 100; -Path Map::findPath(int startX, int startY, int destX, int destY, unsigned char walkmask, int maxCost) +Path Map::findPath(int startX, int startY, int destX, int destY, + unsigned char walkmask, int maxCost) { // Path to be built up (empty by default) Path path; @@ -533,7 +534,8 @@ Path Map::findPath(int startX, int startY, int destX, int destY, unsigned char w // Skip if the tile is on the closed list or is not walkable // unless its the destination tile if (newTile->whichList == mOnClosedList || - ((newTile->blockmask & walkmask) && !(x == destX && y == destY))) + ((newTile->blockmask & walkmask) + && !(x == destX && y == destY))) { continue; } @@ -545,10 +547,8 @@ Path Map::findPath(int startX, int startY, int destX, int destY, unsigned char w MetaTile *t1 = getMetaTile(curr.x, curr.y + dy); MetaTile *t2 = getMetaTile(curr.x + dx, curr.y); - if (t1->blockmask & walkmask && !(t2->blockmask & walkmask)) // I hope I didn't fuck this line up - { + if ((t1->blockmask | t2->blockmask) & BLOCKMASK_WALL) continue; - } } // Calculate G cost for this route, ~sqrt(2) for moving diagonal |