diff options
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/map.cpp b/src/map.cpp index fa3d9a4c..b9bcb284 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -116,11 +116,6 @@ void MapLayer::setTile(int x, int y, Image *img) setTile(x + y * mWidth, img); } -Image* MapLayer::getTile(int x, int y) const -{ - return mTiles[x + y * mWidth]; -} - void MapLayer::draw(Graphics *graphics, int startX, int startY, int endX, int endY, @@ -206,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; |