From 94006f0111d07841d34a4f96e8899448efffa0f0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 22 Oct 2015 20:00:52 +0300 Subject: Fix drawing map after last changes with conditional tiles. --- src/resources/map/maplayer.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/resources') diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp index 920a0f363..23e347483 100644 --- a/src/resources/map/maplayer.cpp +++ b/src/resources/map/maplayer.cpp @@ -139,7 +139,7 @@ void MapLayer::draw(Graphics *const graphics, const int x32 = x * mapTileSize; int c = 0; - const Image *const img = (*tilePtr).image; + const Image *const img = tilePtr->image; if (img) { const int px = x32 + dx; @@ -163,6 +163,7 @@ void MapLayer::draw(Graphics *const graphics, } x += c; + tilePtr += c; } } BLOCK_END("MapLayer::draw") @@ -496,11 +497,13 @@ void MapLayer::drawFringe(Graphics *const graphics, TileInfo *tilePtr = &mTiles[static_cast(startX + yWidth)]; for (int x = startX; x < endX; x++, tilePtr++) { + if (!tilePtr->isEnabled) + continue; const int x32 = x * mapTileSize; const int px1 = x32 - scrollX; int c = 0; - const Image *const img = (*tilePtr).image; + const Image *const img = tilePtr->image; if (img) { if (mSpecialFlag || img->mBounds.h <= mapTileSize) @@ -557,6 +560,7 @@ void MapLayer::drawFringe(Graphics *const graphics, } } x += c; + tilePtr += c; } } @@ -581,8 +585,10 @@ void MapLayer::drawFringe(Graphics *const graphics, TileInfo *tilePtr = &mTiles[static_cast(startX + yWidth)]; for (int x = startX; x < endX; x++, tilePtr++) { + if (!tilePtr->isEnabled) + continue; const int x32 = x * mapTileSize; - const Image *const img = (*tilePtr).image; + const Image *const img = tilePtr->image; if (img) { const int px = x32 + dx; @@ -602,6 +608,7 @@ void MapLayer::drawFringe(Graphics *const graphics, graphics->drawPattern(img, px, py, width, img->mBounds.h); x += c; + tilePtr += c; } } } @@ -672,7 +679,7 @@ int MapLayer::getTileDrawWidth(const TileInfo *tilePtr, { tilePtr ++; const Image *const img = tilePtr->image; - if (img != img1) + if (img != img1 || !tilePtr->isEnabled) break; c ++; if (img) -- cgit v1.2.3-60-g2f50