diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-11 16:44:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-11 16:44:15 +0300 |
commit | 77bb74bd2d944be1a1dc719027dbf37ad088b828 (patch) | |
tree | 0feb040a768eff20220835eb359e767dc43f113c /src/resources/map/map.cpp | |
parent | 835dd846af75ea2cfc91f0134156f9c6545dd8ce (diff) | |
download | mv-77bb74bd2d944be1a1dc719027dbf37ad088b828.tar.gz mv-77bb74bd2d944be1a1dc719027dbf37ad088b828.tar.bz2 mv-77bb74bd2d944be1a1dc719027dbf37ad088b828.tar.xz mv-77bb74bd2d944be1a1dc719027dbf37ad088b828.zip |
Move blocktype into separate file.
Diffstat (limited to 'src/resources/map/map.cpp')
-rw-r--r-- | src/resources/map/map.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index cd94c6ae6..99b27bce2 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -130,7 +130,7 @@ Map::Map(const int width, const int height, mCustom(false) { const int size = mWidth * mHeight; - for (int i = 0; i < NB_BLOCKTYPES; i++) + for (int i = 0; i < BlockType::NB_BLOCKTYPES; i++) { mOccupation[i] = new unsigned[static_cast<size_t>(size)]; memset(mOccupation[i], 0, static_cast<size_t>(size) @@ -153,7 +153,7 @@ Map::~Map() CHECKLISTENERS delete [] mMetaTiles; - for (int i = 0; i < NB_BLOCKTYPES; i++) + for (int i = 0; i < BlockType::NB_BLOCKTYPES; i++) delete [] mOccupation[i]; if (mWalkLayer) @@ -622,9 +622,10 @@ const Tileset *Map::getTilesetWithGid(const int gid) const return nullptr; } -void Map::blockTile(const int x, const int y, const BlockType type) +void Map::blockTile(const int x, const int y, + const BlockType::BlockType type) { - if (type == BLOCKTYPE_NONE || !contains(x, y)) + if (type == BlockType::NONE || !contains(x, y)) return; const int tileNum = x + y * mWidth; @@ -634,30 +635,30 @@ void Map::blockTile(const int x, const int y, const BlockType type) { switch (type) { - case BLOCKTYPE_WALL: + case BlockType::WALL: mMetaTiles[tileNum].blockmask |= BLOCKMASK_WALL; break; - case BLOCKTYPE_CHARACTER: + case BlockType::CHARACTER: mMetaTiles[tileNum].blockmask |= BLOCKMASK_CHARACTER; break; - case BLOCKTYPE_MONSTER: + case BlockType::MONSTER: mMetaTiles[tileNum].blockmask |= BLOCKMASK_MONSTER; break; - case BLOCKTYPE_AIR: + case BlockType::AIR: mMetaTiles[tileNum].blockmask |= BLOCKMASK_AIR; break; - case BLOCKTYPE_WATER: + case BlockType::WATER: mMetaTiles[tileNum].blockmask |= BLOCKMASK_WATER; break; - case BLOCKTYPE_GROUND: + case BlockType::GROUND: mMetaTiles[tileNum].blockmask |= BLOCKMASK_GROUND; break; - case BLOCKTYPE_GROUNDTOP: + case BlockType::GROUNDTOP: mMetaTiles[tileNum].blockmask |= BLOCKMASK_GROUNDTOP; break; default: - case BLOCKTYPE_NONE: - case NB_BLOCKTYPES: + case BlockType::NONE: + case BlockType::NB_BLOCKTYPES: // Do nothing. break; } @@ -686,7 +687,7 @@ unsigned char Map::getBlockMask(const int x, const int y) const void Map::setWalk(const int x, const int y, const bool walkable A_UNUSED) { - blockTile(x, y, Map::BLOCKTYPE_GROUNDTOP); + blockTile(x, y, BlockType::GROUNDTOP); } bool Map::contains(const int x, const int y) const |