(svn r1332) -Fix: Desert-landscape does no longer crash (protected GetMapExtraBits
authortruelight
Mon, 03 Jan 2005 11:11:16 +0000
changeset 851 a4d26deb136b
parent 850 7a9b9f01d5f0
child 852 5ad549960d8b
(svn r1332) -Fix: Desert-landscape does no longer crash (protected GetMapExtraBits
from overflowing)
landscape.c
--- a/landscape.c	Mon Jan 03 09:14:31 2005 +0000
+++ b/landscape.c	Mon Jan 03 11:11:16 2005 +0000
@@ -444,7 +444,11 @@
 
 uint GetMapExtraBits(uint tile)
 {
-	return (_map_extra_bits[tile >> 2] >> (tile&3)*2)&3;
+	if (GET_TILE_X(tile) < MapSizeX() && GET_TILE_Y(tile) < MapSizeY() &&
+			GET_TILE_X(tile) > 0 && GET_TILE_Y(tile) > 0)
+		return (_map_extra_bits[tile >> 2] >> (tile&3)*2)&3;
+	else
+		return 0;
 }
 
 #define TILELOOP_BITS 4