diff options
author | Patric Stout <truebrain@openttd.org> | 2021-03-24 23:25:51 +0100 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-03-26 12:22:32 +0100 |
commit | f05e2e0d408cfd018d9875855bd28383569481a9 (patch) | |
tree | 2f08a052703d6c745935e0abed5e7bb259c94287 /src/tgp.cpp | |
parent | 45c2c29c35afeb4116ff8fb3393ddc67ea1708da (diff) | |
download | openttd-f05e2e0d408cfd018d9875855bd28383569481a9.tar.xz |
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!
Diffstat (limited to 'src/tgp.cpp')
-rw-r--r-- | src/tgp.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tgp.cpp b/src/tgp.cpp index 3ced2a1b0..d86617ee2 100644 --- a/src/tgp.cpp +++ b/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 |