summaryrefslogtreecommitdiff
path: root/src/heightmap.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-10-09 19:57:40 +0000
committerfrosch <frosch@openttd.org>2014-10-09 19:57:40 +0000
commit3836d83e8d1f20d4c017635a2230b8cd517a93b5 (patch)
treefccd7aafd598ee02b151357ce196649f23d71d99 /src/heightmap.cpp
parent7979f9a47509786e11ad47548cd8b0b0257d1280 (diff)
downloadopenttd-3836d83e8d1f20d4c017635a2230b8cd517a93b5.tar.xz
(svn r26984) -Fix (r26905) [FS#6134]: Heightlevels must be scaled by number of intervals, not by the value of the highest interval. Otherwise the highest interval becomes non-proportionally small.
Diffstat (limited to 'src/heightmap.cpp')
-rw-r--r--src/heightmap.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/heightmap.cpp b/src/heightmap.cpp
index acbb202e2..97e525725 100644
--- a/src/heightmap.cpp
+++ b/src/heightmap.cpp
@@ -364,16 +364,16 @@ static void GrayscaleToMapHeights(uint img_width, uint img_height, byte *map)
assert(img_row < img_height);
assert(img_col < img_width);
- /* The height in 1/255ths. */
+ /* The height in 1/256ths. */
uint heightmap_height = map[img_row * img_width + img_col];
- /* The height in 1/255ths of the maximum height. */
- heightmap_height *= _settings_game.construction.max_heightlevel;
+ /* The height in 1/256ths of the maximum height. */
+ heightmap_height *= (1 + _settings_game.construction.max_heightlevel);
/* Scaling should not alter the coastline, thus values in the interval ]0..1] result in a heightlevel of 1 */
- if (IsInsideMM(heightmap_height, 1, UINT8_MAX)) heightmap_height = UINT8_MAX;
+ if (IsInsideMM(heightmap_height, 1, 256)) heightmap_height = 256;
- SetTileHeight(tile, heightmap_height / UINT8_MAX);
+ SetTileHeight(tile, heightmap_height / 256);
}
/* Only clear the tiles within the map area. */
if (IsInnerTile(tile)) {