summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-12-24 22:10:09 +0000
committerrubidium <rubidium@openttd.org>2006-12-24 22:10:09 +0000
commit67f63c858468c897b0d572457ff64cbfb5588f05 (patch)
treec85238269c8f6f765dd700820e79eed50f6e3290
parent5cf3b8a1a92d604d2d3652d6b91bb8eeaf9031ac (diff)
downloadopenttd-67f63c858468c897b0d572457ff64cbfb5588f05.tar.xz
(svn r7555) -Fix (r5479): off-by-one error due do truncation on division by 2. Thanks to Ben_Robbins_ for providing the test case.
-rw-r--r--heightmap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/heightmap.c b/heightmap.c
index ddcc50ccd..aeaa5c38e 100644
--- a/heightmap.c
+++ b/heightmap.c
@@ -318,8 +318,8 @@ static void GrayscaleToMapHeights(uint img_width, uint img_height, byte *map)
/* 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.