summaryrefslogtreecommitdiff
path: root/src/newgrf_commons.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newgrf_commons.cpp')
-rw-r--r--src/newgrf_commons.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp
index 2b1873f7a..5d6aa6630 100644
--- a/src/newgrf_commons.cpp
+++ b/src/newgrf_commons.cpp
@@ -265,5 +265,6 @@ TileIndex GetNearbyTile(byte parameter, TileIndex tile)
if (x >= 8) x -= 16;
if (y >= 8) y -= 16;
- return tile + TileDiffXY(x, y);
+ /* Make sure we never roam outside of the map */
+ return TILE_MASK(tile + TileDiffXY(x, y));
}