From 79dfa4db0cc7d307fe52f1959a30f117efacaa00 Mon Sep 17 00:00:00 2001 From: Eugenio Favalli Date: Tue, 12 Feb 2008 19:49:37 +0000 Subject: Made pathfinding not halt on collision destination tile, made moving around with mouse smoother. Added possibility to pass through players with key controls. --- src/map.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index 2dbf9cb6..c8bdc574 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -276,11 +276,6 @@ void Map::setWalk(int x, int y, bool walkable) mMetaTiles[x + y * mWidth].walkable = walkable; } -bool Map::getWalk(int x, int y) const -{ - return !tileCollides(x, y) && !occupied(x, y); -} - bool Map::occupied(int x, int y) const { Beings &beings = beingManager->getAll(); @@ -340,10 +335,6 @@ Path Map::findPath(int startX, int startY, int destX, int destY) // Declare open list, a list with open tiles sorted on F cost std::priority_queue openList; - // Return empty path when destination collides - if (tileCollides(destX, destY)) - return path; - // Reset starting tile's G cost to 0 MetaTile *startTile = getMetaTile(startX, startY); startTile->Gcost = 0; @@ -388,8 +379,8 @@ Path Map::findPath(int startX, int startY, int destX, int destY) MetaTile *newTile = getMetaTile(x, y); - // Skip if the tile is on the closed list or collides - if (newTile->whichList == mOnClosedList || tileCollides(x, y)) + // Skip if the tile is on the closed list or collides unless its the destination tile + if (newTile->whichList == mOnClosedList || tileCollides(x, y) && !(x == destX && y == destY)) { continue; } -- cgit v1.2.3-70-g09d2