Feature: allow setting a custom terrain type to define highest peak

At least, TGP will try to reach it. It heavily depends on the map
if it is reachable at all. But for sure it will do its atmost to
get there!
This commit is contained in:
Patric Stout
2021-03-24 23:25:51 +01:00
committed by Patric Stout
parent 45c2c29c35
commit f05e2e0d40
7 changed files with 67 additions and 11 deletions

View File

@@ -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