diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-07-31 17:09:55 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-08-05 18:18:21 +0200 |
commit | 1937b8e19e370a8fa9a47339e07415a315b7c935 (patch) | |
tree | af9e8d8d3eee38232c97b9c9620e64db9532a3cb /src/map.cpp | |
parent | 07651f85c29cde1e59d1b6fb48f3a8fdd71cb275 (diff) | |
download | mana-1937b8e19e370a8fa9a47339e07415a315b7c935.tar.gz mana-1937b8e19e370a8fa9a47339e07415a315b7c935.tar.bz2 mana-1937b8e19e370a8fa9a47339e07415a315b7c935.tar.xz mana-1937b8e19e370a8fa9a47339e07415a315b7c935.zip |
Fixed drawing issues with tiles that don't match the grid
An optimization in the tile layer rendering code meant for drawing
repeated tiles faster was not taking into account the case where the
tile width does not match the width of the tile grid.
Reviewed-by: Stefan Beller
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/map.cpp b/src/map.cpp index b647d5d5..b9bcb284 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -201,12 +201,17 @@ int MapLayer::getTileDrawWidth(int x1, int y1, int endX, int &width) const Image *img1 = getTile(x1, y1); int c = 0; width = img1->getWidth(); + + // Images that don't match the tile width can't be drawn as a pattern + if (width != mMap->getTileWidth()) + return c; + for (int x = x1 + 1; x < endX; x++) { Image *img = getTile(x, y1); if (img != img1) break; - c ++; + c++; width += img->getWidth(); } return c; |