Changeset - r21762:d09b81abeca2
[Not reviewed]
master
0 1 0
rubidium - 10 years ago 2014-09-21 18:29:18
rubidium@openttd.org
(svn r26905) -Change: account for the maximum map height when converting heightmaps
1 file changed with 10 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/heightmap.cpp
Show inline comments
 
@@ -364,8 +364,16 @@ static void GrayscaleToMapHeights(uint i
 
				assert(img_row < img_height);
 
				assert(img_col < img_width);
 

	
 
				/* Colour scales from 0 to 255, OpenTTD height scales from 0 to 15 */
 
				SetTileHeight(tile, map[img_row * img_width + img_col] / 16);
 
				/* The height in 1/255ths. */
 
				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;
 

	
 
				/* 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;
 

	
 
				SetTileHeight(tile, heightmap_height / UINT8_MAX);
 
			}
 
			/* Only clear the tiles within the map area. */
 
			if (IsInnerTile(tile)) {
0 comments (0 inline, 0 general)