(svn r7555) -Fix (r5479): off-by-one error due do truncation on division by 2. Thanks to Ben_Robbins_ for providing the test case.
authorrubidium
Sun, 24 Dec 2006 22:10:09 +0000
changeset 5558 6bb52a5060a8
parent 5557 dc2402eb851b
child 5559 10610f5e6e38
(svn r7555) -Fix (r5479): off-by-one error due do truncation on division by 2. Thanks to Ben_Robbins_ for providing the test case.
heightmap.c
--- a/heightmap.c	Sun Dec 24 19:20:28 2006 +0000
+++ b/heightmap.c	Sun Dec 24 22:10:09 2006 +0000
@@ -318,8 +318,8 @@
 
 			/* Check if current tile is within the 1-pixel map edge or padding regions */
 			if ((DistanceFromEdge(tile) <= 1) ||
-					(row < row_pad) || (row >= (height - row_pad)) ||
-					(col < col_pad) || (col >= (width - col_pad))) {
+					(row < row_pad) || (row >= (img_height + row_pad)) ||
+					(col < col_pad) || (col >= (img_width  + col_pad))) {
 				SetTileHeight(tile, 0);
 			} else {
 				/* Use nearest neighbor resizing to scale map data.