summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-15 21:14:04 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-15 21:14:04 +0300
commit7b89705cc5c491b60dab923e2f8079cfc1f4bce1 (patch)
treea3a5ceb5a142b9b954eab23c39946b0825218169 /src/resources
parent8b22861c92f1cec3af31b8b9e97b16498b2d86d0 (diff)
downloadplus-7b89705cc5c491b60dab923e2f8079cfc1f4bce1.tar.gz
plus-7b89705cc5c491b60dab923e2f8079cfc1f4bce1.tar.bz2
plus-7b89705cc5c491b60dab923e2f8079cfc1f4bce1.tar.xz
plus-7b89705cc5c491b60dab923e2f8079cfc1f4bce1.zip
Convert BlockType into strong typed enum.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/beinginfo.h6
-rw-r--r--src/resources/map/map.cpp6
-rw-r--r--src/resources/map/map.h4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index ad5f35a85..a4ee2a750 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -119,10 +119,10 @@ class BeingInfo final
unsigned char getBlockWalkMask() const A_WARN_UNUSED
{ return mBlockWalkMask; }
- void setBlockType(const BlockType::BlockType &blockType)
+ void setBlockType(const BlockTypeT &blockType)
{ mBlockType = blockType; }
- BlockType::BlockType getBlockType() const A_WARN_UNUSED
+ BlockTypeT getBlockType() const A_WARN_UNUSED
{ return mBlockType; }
void setTargetOffsetX(const int n)
@@ -338,7 +338,7 @@ class BeingInfo final
Attacks mAttacks;
std::vector<BeingMenuItem> mMenu;
unsigned char mBlockWalkMask;
- BlockType::BlockType mBlockType;
+ BlockTypeT mBlockType;
const std::map <ItemColor, ColorDB::ItemColorData> *mColors;
int mTargetOffsetX;
int mTargetOffsetY;
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index e206edef2..e1407af91 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -148,7 +148,7 @@ Map::Map(const int width, const int height,
mDrawOnlyFringe(false)
{
const int size = mWidth * mHeight;
- for (int i = 0; i < BlockType::NB_BLOCKTYPES; i++)
+ for (size_t i = 0; i < static_cast<size_t>(BlockType::NB_BLOCKTYPES); i++)
{
mOccupation[i] = new unsigned[static_cast<size_t>(size)];
memset(mOccupation[i], 0, static_cast<size_t>(size)
@@ -171,7 +171,7 @@ Map::~Map()
CHECKLISTENERS
delete [] mMetaTiles;
- for (int i = 0; i < BlockType::NB_BLOCKTYPES; i++)
+ for (size_t i = 0; i < static_cast<size_t>(BlockType::NB_BLOCKTYPES); i++)
delete [] mOccupation[i];
if (mWalkLayer)
@@ -690,7 +690,7 @@ const Tileset *Map::getTilesetWithGid(const int gid) const
}
void Map::blockTile(const int x, const int y,
- const BlockType::BlockType type)
+ const BlockTypeT type)
{
if (type == BlockType::NONE || !contains(x, y))
return;
diff --git a/src/resources/map/map.h b/src/resources/map/map.h
index 33b819c04..49e0459f2 100644
--- a/src/resources/map/map.h
+++ b/src/resources/map/map.h
@@ -146,7 +146,7 @@ class Map final : public Properties, public ConfigListener
* Marks a tile as occupied.
*/
void blockTile(const int x, const int y,
- const BlockType::BlockType type);
+ const BlockTypeT type);
/**
* Gets walkability for a tile with a blocking bitmask. When called
@@ -378,7 +378,7 @@ class Map final : public Properties, public ConfigListener
/**
* Blockmasks for different entities
*/
- unsigned *mOccupation[BlockType::NB_BLOCKTYPES];
+ unsigned *mOccupation[static_cast<size_t>(BlockType::NB_BLOCKTYPES)];
const int mWidth;
const int mHeight;