diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-05 16:07:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-05 16:07:44 +0300 |
commit | 8480ff2ce8ac1ce1ceba024eddfaeb62a5d20f8d (patch) | |
tree | 5cc8d0097ce680cca550216e2313d1d1cb550cfc /src/resources | |
parent | 3aaf10f021303dd67a2c36bf23f380348b5bdf02 (diff) | |
download | manaplus-8480ff2ce8ac1ce1ceba024eddfaeb62a5d20f8d.tar.gz manaplus-8480ff2ce8ac1ce1ceba024eddfaeb62a5d20f8d.tar.bz2 manaplus-8480ff2ce8ac1ce1ceba024eddfaeb62a5d20f8d.tar.xz manaplus-8480ff2ce8ac1ce1ceba024eddfaeb62a5d20f8d.zip |
Rename walkMask into blockWalkMask.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/beinginfo.cpp | 6 | ||||
-rw-r--r-- | src/resources/beinginfo.h | 10 | ||||
-rw-r--r-- | src/resources/db/monsterdb.cpp | 5 | ||||
-rw-r--r-- | src/resources/map/map.cpp | 12 | ||||
-rw-r--r-- | src/resources/map/map.h | 4 |
5 files changed, 18 insertions, 19 deletions
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index bd4359144..5f1704b88 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -52,9 +52,9 @@ BeingInfo::BeingInfo() : mHoverCursor(Cursor::CURSOR_POINTER), mSounds(), mAttacks(), - mWalkMask(BlockMask::WALL | BlockMask::CHARACTER - | BlockMask::MONSTER | BlockMask::AIR - | BlockMask::WATER), + mBlockWalkMask(BlockMask::WALL | BlockMask::CHARACTER + | BlockMask::MONSTER | BlockMask::AIR + | BlockMask::WATER), mBlockType(BlockType::CHARACTER), mColors(nullptr), mTargetOffsetX(0), diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h index efac5cc3a..76955d2dd 100644 --- a/src/resources/beinginfo.h +++ b/src/resources/beinginfo.h @@ -110,14 +110,14 @@ class BeingInfo final const Attack *getAttack(const int id) const A_WARN_UNUSED; - void setWalkMask(const unsigned char mask) - { mWalkMask = mask; } + void setBlockWalkMask(const unsigned char mask) + { mBlockWalkMask = mask; } /** * Gets the way the being is blocked by other objects */ - unsigned char getWalkMask() const A_WARN_UNUSED - { return mWalkMask; } + unsigned char getBlockWalkMask() const A_WARN_UNUSED + { return mBlockWalkMask; } void setBlockType(const BlockType::BlockType &blockType) { mBlockType = blockType; } @@ -326,7 +326,7 @@ class BeingInfo final Cursor::Cursor mHoverCursor; ItemSoundEvents mSounds; Attacks mAttacks; - unsigned char mWalkMask; + unsigned char mBlockWalkMask; BlockType::BlockType mBlockType; const std::map <int, ColorDB::ItemColor> *mColors; int mTargetOffsetX; diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp index a78707571..7897d6198 100644 --- a/src/resources/db/monsterdb.cpp +++ b/src/resources/db/monsterdb.cpp @@ -97,10 +97,7 @@ void MonsterDB::loadXmlFile(const std::string &fileName) if (!currentInfo) currentInfo = new BeingInfo; - currentInfo->setWalkMask(BlockMask::WALL - | BlockMask::CHARACTER | BlockMask::MONSTER); currentInfo->setBlockType(BlockType::MONSTER); - currentInfo->setName(XML::langProperty( // TRANSLATORS: unknown info name monsterNode, "name", _("unnamed"))); @@ -127,7 +124,7 @@ void MonsterDB::loadXmlFile(const std::string &fileName) else if (walkStr == "walkswim" || walkStr == "swimwalk") block = BlockMask::AIR; - currentInfo->setWalkMask(static_cast<unsigned char>( + currentInfo->setBlockWalkMask(static_cast<unsigned char>( BlockMask::WALL | block)); if (currentInfo->getMaxHP()) 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; /** |