summaryrefslogtreecommitdiff
path: root/src/resources/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
commit9fe21fcd8883b37bdc30224822e6e42afb35b8f0 (patch)
tree798117abd4dc7e610997d59d530a96ddc1509f53 /src/resources/map
parent4429cb14e9e187edef27aba692a4266733f79c17 (diff)
downloadManaVerse-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.gz
ManaVerse-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.bz2
ManaVerse-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.xz
ManaVerse-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.zip
Replace most static_cast<Type> to shorter versions from defines.
Diffstat (limited to 'src/resources/map')
-rw-r--r--src/resources/map/map.cpp16
-rw-r--r--src/resources/map/map.h2
-rw-r--r--src/resources/map/mapheights.h2
-rw-r--r--src/resources/map/maplayer.cpp10
4 files changed, 15 insertions, 15 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index cb5d67583..51bb90f9d 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -1207,7 +1207,7 @@ void Map::saveExtraLayer() const restrict2
&& item->mType != MapItemType::HOME)
{
mapFile << x << " " << y << " "
- << static_cast<int>(item->mType) << " "
+ << CAST_S32(item->mType) << " "
<< item->mComment << std::endl;
}
}
@@ -1365,8 +1365,8 @@ void Map::indexTilesets() restrict2
FOR_EACH (Tilesets::const_iterator, it, mTilesets)
{
const size_t sz = (*it)->size();
- if (!s || static_cast<size_t>(s->getFirstGid()) + sSz
- < static_cast<size_t>((*it)->getFirstGid()) + sz)
+ if (!s || CAST_SIZE(s->getFirstGid()) + sSz
+ < CAST_SIZE((*it)->getFirstGid()) + sz)
{
s = *it;
sSz = sz;
@@ -1379,10 +1379,10 @@ void Map::indexTilesets() restrict2
return;
}
- const int size = static_cast<int>(s->getFirstGid())
- + static_cast<int>(s->size());
+ const int size = CAST_S32(s->getFirstGid())
+ + CAST_S32(s->size());
mIndexedTilesetsSize = size;
- mIndexedTilesets = new Tileset*[static_cast<size_t>(size)];
+ mIndexedTilesets = new Tileset*[CAST_SIZE(size)];
std::fill_n(mIndexedTilesets, size, static_cast<Tileset*>(nullptr));
FOR_EACH (Tilesets::const_iterator, it, mTilesets)
@@ -1391,7 +1391,7 @@ void Map::indexTilesets() restrict2
if (s2)
{
const int start = s2->getFirstGid();
- const int end = start + static_cast<int>(s2->size());
+ const int end = start + CAST_S32(s2->size());
for (int f = start; f < end; f ++)
{
if (f < size)
@@ -1546,7 +1546,7 @@ void Map::reduce() restrict2
++ ri;
continue;
}
- const size_t pos = static_cast<size_t>(
+ const size_t pos = CAST_SIZE(
x + y * layer2->mWidth);
img = layer2->mTiles[pos].image;
if (img)
diff --git a/src/resources/map/map.h b/src/resources/map/map.h
index ea540907a..4ee387f8f 100644
--- a/src/resources/map/map.h
+++ b/src/resources/map/map.h
@@ -290,7 +290,7 @@ class Map final : public Properties, public ConfigListener
const int y) const restrict2 A_WARN_UNUSED;
int getActorsCount() const restrict2 A_WARN_UNUSED
- { return static_cast<int>(mActors.size()); }
+ { return CAST_S32(mActors.size()); }
void setPvpMode(const int mode) restrict2;
diff --git a/src/resources/map/mapheights.h b/src/resources/map/mapheights.h
index 67e73bcc4..333e7fac4 100644
--- a/src/resources/map/mapheights.h
+++ b/src/resources/map/mapheights.h
@@ -38,7 +38,7 @@ class MapHeights final
uint8_t getHeight(const int x, const int y) const
{ return x < mWidth && y < mHeight ? mTiles[x + y * mWidth]
- : static_cast<uint8_t>(0U); }
+ : CAST_U8(0U); }
private:
int mWidth;
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index bedd0da35..6567b2177 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -135,7 +135,7 @@ void MapLayer::draw(Graphics *const graphics,
const int py0 = y32 + dy;
- TileInfo *tilePtr = &mTiles[static_cast<size_t>(startX + yWidth)];
+ TileInfo *tilePtr = &mTiles[CAST_SIZE(startX + yWidth)];
for (int x = startX; x < endX; x++, tilePtr++)
{
@@ -235,7 +235,7 @@ void MapLayer::updateSDL(const Graphics *const graphics,
const int yWidth = y * mWidth;
const int py0 = y * mapTileSize + dy;
- TileInfo *tilePtr = &mTiles[static_cast<size_t>(startX + yWidth)];
+ TileInfo *tilePtr = &mTiles[CAST_SIZE(startX + yWidth)];
for (int x = startX; x < endX; x++, tilePtr++)
{
@@ -304,7 +304,7 @@ void MapLayer::updateOGL(Graphics *const graphics,
{
const int yWidth = y * mWidth;
const int py0 = y * mapTileSize + dy;
- TileInfo *tilePtr = &mTiles[static_cast<size_t>(startX + yWidth)];
+ TileInfo *tilePtr = &mTiles[CAST_SIZE(startX + yWidth)];
for (int x = startX; x < endX; x++, tilePtr++)
{
if (!tilePtr->isEnabled)
@@ -509,7 +509,7 @@ void MapLayer::drawFringe(Graphics *const graphics,
const int py0 = y32 + dy;
const int py1 = y32 - scrollY;
- TileInfo *tilePtr = &mTiles[static_cast<size_t>(startX + yWidth)];
+ TileInfo *tilePtr = &mTiles[CAST_SIZE(startX + yWidth)];
for (int x = startX; x < endX; x++, tilePtr++)
{
if (!tilePtr->isEnabled)
@@ -598,7 +598,7 @@ void MapLayer::drawFringe(Graphics *const graphics,
const int py0 = y32 + dy;
- TileInfo *tilePtr = &mTiles[static_cast<size_t>(startX + yWidth)];
+ TileInfo *tilePtr = &mTiles[CAST_SIZE(startX + yWidth)];
for (int x = startX; x < endX; x++, tilePtr++)
{
if (!tilePtr->isEnabled)