diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp index 2b1873f7af..5d6aa6630b 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)); }