summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-03 22:39:53 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-03 22:39:53 +0300
commit75de17c7a86060f1c9475350c2e1bc7a712cd6b8 (patch)
treeff0a9556a1b71de40de29d7fbed3a80ebb286689 /src
parent6e09393c9d4a2f36c582ff97c0f5d5263757cbcc (diff)
downloadmanaverse-75de17c7a86060f1c9475350c2e1bc7a712cd6b8.tar.gz
manaverse-75de17c7a86060f1c9475350c2e1bc7a712cd6b8.tar.bz2
manaverse-75de17c7a86060f1c9475350c2e1bc7a712cd6b8.tar.xz
manaverse-75de17c7a86060f1c9475350c2e1bc7a712cd6b8.zip
Fix special layers draw crash.
Diffstat (limited to 'src')
-rw-r--r--src/resources/map/maplayer.cpp11
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];
}
}