Changeset - r21832:ab9f1fd7cbaf
[Not reviewed]
master
0 1 0
frosch - 10 years ago 2014-10-09 19:57:40
frosch@openttd.org
(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.
1 file changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/heightmap.cpp
Show inline comments
 
@@ -364,16 +364,16 @@ static void GrayscaleToMapHeights(uint i
 
				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)) {
0 comments (0 inline, 0 general)