diff options
Diffstat (limited to 'src/resources/map')
-rw-r--r-- | src/resources/map/map.cpp | 12 | ||||
-rw-r--r-- | src/resources/map/map.h | 4 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index f7f4b900f..694c6f934 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -672,14 +672,15 @@ void Map::blockTile(const int x, const int y, } } -bool Map::getWalk(const int x, const int y, const unsigned char walkmask) const +bool Map::getWalk(const int x, const int y, + const unsigned char blockWalkMask) const { // You can't walk outside of the map if (x < 0 || y < 0 || x >= mWidth || y >= mHeight) return false; // Check if the tile is walkable - return !(mMetaTiles[x + y * mWidth].blockmask & walkmask); + return !(mMetaTiles[x + y * mWidth].blockmask & blockWalkMask); } unsigned char Map::getBlockMask(const int x, const int y) const @@ -742,7 +743,8 @@ const std::string Map::getFilename() const Path Map::findPath(const int startX, const int startY, const int destX, const int destY, - const unsigned char walkmask, const int maxCost) + const unsigned char blockWalkMask, + const int maxCost) { BLOCK_START("Map::findPath") // The basic walking cost of a tile. @@ -760,7 +762,7 @@ Path Map::findPath(const int startX, const int startY, } // Return when destination not walkable - if (!getWalk(destX, destY, walkmask)) + if (!getWalk(destX, destY, blockWalkMask)) { BLOCK_END("Map::findPath") return path; @@ -830,7 +832,7 @@ Path Map::findPath(const int startX, const int startY, // unless its the destination tile // +++ here need check block must depend on player abilities. if (newTile->whichList == mOnClosedList || - ((newTile->blockmask & walkmask) + ((newTile->blockmask & blockWalkMask) && !(x == destX && y == destY)) || (newTile->blockmask & BlockMask::WALL)) { diff --git a/src/resources/map/map.h b/src/resources/map/map.h index 21976d38a..2026500ad 100644 --- a/src/resources/map/map.h +++ b/src/resources/map/map.h @@ -150,7 +150,7 @@ class Map final : public Properties, public ConfigListener * without walkmask, only blocks against colliding tiles. */ bool getWalk(const int x, const int y, - const unsigned char walkmask = BlockMask::WALL + const unsigned char blockWalkMask = BlockMask::WALL | BlockMask::AIR | BlockMask::WATER) const A_WARN_UNUSED; void setWalk(const int x, const int y, const bool walkable); @@ -197,7 +197,7 @@ class Map final : public Properties, public ConfigListener */ Path findPath(const int startX, const int startY, const int destX, const int destY, - const unsigned char walkmask, + const unsigned char blockWalkmask, const int maxCost = 20) A_WARN_UNUSED; /** |