From de084ace1cb4abc47a4e06d430e36c6860fbd371 Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 12 Jul 2007 08:10:40 +0000 Subject: (svn r10519) -Fix: when getting a "nearby" tile, make sure you never roam outside of the map. --- src/newgrf_commons.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/newgrf_commons.cpp') 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)); } -- cgit v1.2.3-54-g00ecf