diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-01-03 22:39:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-01-03 22:39:53 +0300 |
commit | 75de17c7a86060f1c9475350c2e1bc7a712cd6b8 (patch) | |
tree | ff0a9556a1b71de40de29d7fbed3a80ebb286689 /src/resources | |
parent | 6e09393c9d4a2f36c582ff97c0f5d5263757cbcc (diff) | |
download | ManaVerse-75de17c7a86060f1c9475350c2e1bc7a712cd6b8.tar.gz ManaVerse-75de17c7a86060f1c9475350c2e1bc7a712cd6b8.tar.bz2 ManaVerse-75de17c7a86060f1c9475350c2e1bc7a712cd6b8.tar.xz ManaVerse-75de17c7a86060f1c9475350c2e1bc7a712cd6b8.zip |
Fix special layers draw crash.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/map/maplayer.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp index 6557e07a6..d92184e28 100644 --- a/src/resources/map/maplayer.cpp +++ b/src/resources/map/maplayer.cpp @@ -400,11 +400,11 @@ void MapLayer::drawSpecialLayer(Graphics *const graphics, const int scrollX, const int scrollY) const restrict { - const int specialWidth = mSpecialLayer->mWidth; const int y32 = y * mapTileSize; - const int ptr = y * specialWidth; const int py1 = y32 - scrollY; int endX1 = endX; + int specialWidth = mSpecialLayer->mWidth; + int ptr = y * specialWidth; if (endX1 > specialWidth) endX1 = specialWidth; if (endX1 < 0) @@ -427,6 +427,11 @@ void MapLayer::drawSpecialLayer(Graphics *const graphics, x += mSpecialLayer->mCache[ptr + x]; } + specialWidth = mTempLayer->mWidth; + ptr = y * specialWidth; + endX1 = endX; + if (endX1 > specialWidth) + endX1 = specialWidth; item0 = mTempLayer->mTiles[ptr + startX]; if (!item0 || item0->mType == MapItemType::EMPTY) { @@ -441,7 +446,7 @@ void MapLayer::drawSpecialLayer(Graphics *const graphics, item->draw(graphics, px1, py1, mapTileSize, mapTileSize); } - x += mSpecialLayer->mCache[ptr + x]; + x += mTempLayer->mCache[ptr + x]; } } |