From 767b8400fb086616616a298655f0bc2eaf239256 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 May 2014 22:48:11 +0300 Subject: Fix code style in other files. --- src/map.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index b4112231d..1acfdf711 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -183,8 +183,9 @@ Map::Map(const int width, const int height, const int size = mWidth * mHeight; for (int i = 0; i < NB_BLOCKTYPES; i++) { - mOccupation[i] = new unsigned[size]; - memset(mOccupation[i], 0, size * sizeof(unsigned)); + mOccupation[i] = new unsigned[static_cast(size)]; + memset(mOccupation[i], 0, static_cast(size) + * sizeof(unsigned)); } config.addListener("OverlayDetail", this); @@ -679,8 +680,8 @@ void Map::blockTile(const int x, const int y, const BlockType type) const int tileNum = x + y * mWidth; - if (mOccupation[type][tileNum] < UINT_MAX && - (++mOccupation[type][tileNum]) > 0) + if (mOccupation[static_cast(type)][tileNum] < UINT_MAX && + (++mOccupation[static_cast(type)][tileNum]) > 0) { switch (type) { @@ -1296,8 +1297,8 @@ void Map::indexTilesets() FOR_EACH (Tilesets::const_iterator, it, mTilesets) { const size_t sz = (*it)->size(); - if (!s || s->getFirstGid() + sSz - < (*it)->getFirstGid() + sz) + if (!s || static_cast(s->getFirstGid()) + sSz + < static_cast((*it)->getFirstGid()) + sz) { s = *it; sSz = sz; @@ -1313,7 +1314,7 @@ void Map::indexTilesets() const int size = static_cast(s->getFirstGid()) + static_cast(s->size()); mIndexedTilesetsSize = size; - mIndexedTilesets = new Tileset*[size]; + mIndexedTilesets = new Tileset*[static_cast(size)]; std::fill_n(mIndexedTilesets, size, static_cast(nullptr)); FOR_EACH (Tilesets::const_iterator, it, mTilesets) @@ -1322,7 +1323,7 @@ void Map::indexTilesets() if (s2) { const int start = s2->getFirstGid(); - const int end = static_cast(start + s2->size()); + const int end = start + static_cast(s2->size()); for (int f = start; f < end; f ++) { if (f < size) @@ -1456,7 +1457,8 @@ void Map::reduce() while (ri != mLayers.rend()) { MapLayer *const layer2 = *ri; - const size_t pos = x + y * layer2->mWidth; + const size_t pos = static_cast( + x + y * layer2->mWidth); img = layer2->mTiles[pos]; if (img) { -- cgit v1.2.3-60-g2f50