openttd updated to 1.5.0-beta2
--HG-- branch : openttd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: heightmap.cpp 26057 2013-11-23 13:12:19Z rubidium $ */
|
||||
/* $Id: heightmap.cpp 27044 2014-10-25 22:24:05Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
/**
|
||||
* Convert RGB colours to Grayscale using 29.9% Red, 58.7% Green, 11.4% Blue
|
||||
* (average luminosity formula, NTSC Colour Space)
|
||||
@@ -362,8 +364,16 @@ static void GrayscaleToMapHeights(uint img_width, uint img_height, byte *map)
|
||||
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);
|
||||
uint heightmap_height = map[img_row * img_width + img_col];
|
||||
|
||||
if (heightmap_height > 0) {
|
||||
/* 0 is sea level.
|
||||
* Other grey scales are scaled evenly to the available height levels > 0.
|
||||
* (The coastline is independent from the number of height levels) */
|
||||
heightmap_height = 1 + (heightmap_height - 1) * _settings_game.construction.max_heightlevel / 255;
|
||||
}
|
||||
|
||||
SetTileHeight(tile, heightmap_height);
|
||||
}
|
||||
/* Only clear the tiles within the map area. */
|
||||
if (IsInnerTile(tile)) {
|
||||
|
||||
Reference in New Issue
Block a user