(svn r10519) -Fix: when getting a "nearby" tile, make sure you never roam outside of the map.
authorrubidium
Thu, 12 Jul 2007 08:10:40 +0000
changeset 7734 56228bfe84bc
parent 7733 262c3a8de735
child 7735 6c600a540a44
(svn r10519) -Fix: when getting a "nearby" tile, make sure you never roam outside of the map.
src/newgrf_commons.cpp
--- a/src/newgrf_commons.cpp	Thu Jul 12 07:57:08 2007 +0000
+++ b/src/newgrf_commons.cpp	Thu Jul 12 08:10:40 2007 +0000
@@ -265,5 +265,6 @@
 	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));
 }