From 7a178f6d257a2241d3400271d20eb2b902fdab37 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Tue, 31 Jul 2012 17:09:55 +0200 Subject: 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. --- src/map.cpp | 7 ++++++- src/map.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index fa3d9a4c..9736e527 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -206,12 +206,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; diff --git a/src/map.h b/src/map.h index b7917275..6fe2b556 100644 --- a/src/map.h +++ b/src/map.h @@ -125,7 +125,7 @@ class MapLayer const Actors &actors, int debugFlags) const; - bool isFringeLayer() + bool isFringeLayer() const { return mIsFringeLayer; } int getTileDrawWidth(int x1, int y1, int endX, int &width) const; -- cgit v1.2.3-70-g09d2