From 32457dd5b2f9431d4f5d503dc8b090a9c1b7f944 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 8 Jun 2009 23:05:15 +0200 Subject: 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 --- src/map.cpp | 10 +++++----- 1 file 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 -- cgit v1.2.3-60-g2f50