diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2008-02-12 19:49:37 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2008-02-12 19:49:37 +0000 |
commit | 79dfa4db0cc7d307fe52f1959a30f117efacaa00 (patch) | |
tree | c44cd018b8f9f320fb2a1f0c8aed47a24ac14e2b /src/map.cpp | |
parent | 34e9c3e9125ef800ef47e2594cf23853deddccfb (diff) | |
download | mana-79dfa4db0cc7d307fe52f1959a30f117efacaa00.tar.gz mana-79dfa4db0cc7d307fe52f1959a30f117efacaa00.tar.bz2 mana-79dfa4db0cc7d307fe52f1959a30f117efacaa00.tar.xz mana-79dfa4db0cc7d307fe52f1959a30f117efacaa00.zip |
Made pathfinding not halt on collision destination tile, made moving around with mouse smoother. Added possibility to pass through players with key controls.
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
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<Location> 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; } |