summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-28 19:27:10 +0000
committeryexo <yexo@openttd.org>2010-01-28 19:27:10 +0000
commit6be456052859844de5efe0e3890df93422e50676 (patch)
treebaa8667e1b3c0d89a88d9d8a99f6dcc8454d2dde
parent8ee96d4d45d3804953e05db1557b75a15a492cb4 (diff)
downloadopenttd-6be456052859844de5efe0e3890df93422e50676.tar.xz
(svn r18937) -Fix (r15190): TileAddWrap didn't return INVALID_TILE for void tiles at the north border
-rw-r--r--src/map.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 0d2b146ce..9c930d694 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -115,9 +115,11 @@ TileIndex TileAddWrap(TileIndex tile, int addx, int addy)
uint x = TileX(tile) + addx;
uint y = TileY(tile) + addy;
+ /* Disallow void tiles at the north border. */
+ if (_settings_game.construction.freeform_edges && (x == 0 || y == 0)) return INVALID_TILE;
+
/* Are we about to wrap? */
- if (x < MapMaxX() && y < MapMaxY())
- return tile + TileDiffXY(addx, addy);
+ if (x < MapMaxX() && y < MapMaxY()) return tile + TileDiffXY(addx, addy);
return INVALID_TILE;
}