summaryrefslogtreecommitdiff
path: root/src/newgrf_commons.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-12 08:10:40 +0000
committerrubidium <rubidium@openttd.org>2007-07-12 08:10:40 +0000
commitde084ace1cb4abc47a4e06d430e36c6860fbd371 (patch)
tree8188c08aafd2b5a60fd55c0863f1ec04dd4c01b7 /src/newgrf_commons.cpp
parent9dee5402332496582e02beb9aed2733a0974491c (diff)
downloadopenttd-de084ace1cb4abc47a4e06d430e36c6860fbd371.tar.xz
(svn r10519) -Fix: when getting a "nearby" tile, make sure you never roam outside of the map.
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));
}