Merge branch 'master' into jgrpp
# Conflicts: # src/cheat_gui.cpp # src/genworld_gui.cpp # src/landscape.cpp # src/lang/english.txt # src/saveload/afterload.cpp # src/screenshot.cpp # src/settings_gui.cpp # src/settings_internal.h # src/settings_type.h # src/table/settings.ini # src/tile_type.h # src/widgets/genworld_widget.h
This commit is contained in:
36
src/tgp.cpp
36
src/tgp.cpp
@@ -215,6 +215,13 @@ static const amplitude_t _water_percent[4] = {70, 170, 270, 420};
|
||||
*/
|
||||
static height_t TGPGetMaxHeight()
|
||||
{
|
||||
if (_settings_game.difficulty.terrain_type == CUSTOM_TERRAIN_TYPE_NUMBER_DIFFICULTY) {
|
||||
/* TGP never reaches this height; this means that if a user inputs "2",
|
||||
* it would create a flat map without the "+ 1". But that would
|
||||
* overflow on "255". So we reduce it by 1 to get back in range. */
|
||||
return I2H(_settings_game.game_creation.custom_terrain_type + 1) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Desired maximum height - indexed by:
|
||||
* - _settings_game.difficulty.terrain_type
|
||||
@@ -238,25 +245,20 @@ static height_t TGPGetMaxHeight()
|
||||
int map_size_bucket = std::min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS;
|
||||
int max_height_from_table = max_height[_settings_game.difficulty.terrain_type][map_size_bucket];
|
||||
|
||||
/* Arctic needs snow to have all industries, so make sure we allow TGP to generate this high. */
|
||||
if (_settings_game.game_creation.landscape == LT_ARCTIC) {
|
||||
max_height_from_table += _settings_newgame.game_creation.snow_line_height;
|
||||
/* Make flat a bit more flat by removing "very flat" from it, to somewhat compensate for the increase we just did. */
|
||||
if (_settings_game.difficulty.terrain_type > 0) {
|
||||
max_height_from_table -= max_height[_settings_game.difficulty.terrain_type - 1][map_size_bucket];
|
||||
}
|
||||
}
|
||||
/* Tropic needs tropical forest to have all industries, so make sure we allow TGP to generate this high.
|
||||
* Tropic forest always starts at 1/4th of the max height. */
|
||||
if (_settings_game.game_creation.landscape == LT_TROPIC) {
|
||||
max_height_from_table += CeilDiv(_settings_game.construction.max_heightlevel, 4);
|
||||
/* Make flat a bit more flat by removing "very flat" from it, to somewhat compensate for the increase we just did. */
|
||||
if (_settings_game.difficulty.terrain_type > 0) {
|
||||
max_height_from_table -= max_height[_settings_game.difficulty.terrain_type - 1][map_size_bucket];
|
||||
}
|
||||
/* If there is a manual map height limit, clamp to it. */
|
||||
if (_settings_game.construction.map_height_limit != 0) {
|
||||
max_height_from_table = std::min<uint>(max_height_from_table, _settings_game.construction.map_height_limit);
|
||||
}
|
||||
|
||||
return I2H(std::min<uint>(max_height_from_table, _settings_game.construction.max_heightlevel));
|
||||
return I2H(max_height_from_table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an overestimation of the highest peak TGP wants to generate.
|
||||
*/
|
||||
uint GetEstimationTGPMapHeight()
|
||||
{
|
||||
return H2I(TGPGetMaxHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user