From 9fe21fcd8883b37bdc30224822e6e42afb35b8f0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 7 Feb 2016 16:18:13 +0300 Subject: Replace most static_cast to shorter versions from defines. --- src/resources/map/map.cpp | 16 ++++++++-------- src/resources/map/map.h | 2 +- src/resources/map/mapheights.h | 2 +- src/resources/map/maplayer.cpp | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/resources/map') 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(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(s->getFirstGid()) + sSz - < static_cast((*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(s->getFirstGid()) - + static_cast(s->size()); + const int size = CAST_S32(s->getFirstGid()) + + CAST_S32(s->size()); mIndexedTilesetsSize = size; - mIndexedTilesets = new Tileset*[static_cast(size)]; + mIndexedTilesets = new Tileset*[CAST_SIZE(size)]; std::fill_n(mIndexedTilesets, size, static_cast(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(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( + 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(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(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(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(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(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(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(startX + yWidth)]; + TileInfo *tilePtr = &mTiles[CAST_SIZE(startX + yWidth)]; for (int x = startX; x < endX; x++, tilePtr++) { if (!tilePtr->isEnabled) -- cgit v1.2.3-60-g2f50