diff --git a/src/genworld.h b/src/genworld.h index d7de534998..d662bbb6c8 100644 --- a/src/genworld.h +++ b/src/genworld.h @@ -49,6 +49,8 @@ static const uint CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY = 4; ///< Value for custom static const uint CUSTOM_SEA_LEVEL_MIN_PERCENTAGE = 1; ///< Minimum percentage a user can specify for custom sea level. static const uint CUSTOM_SEA_LEVEL_MAX_PERCENTAGE = 90; ///< Maximum percentage a user can specify for custom sea level. +static constexpr uint MAP_HEIGHT_LIMIT_ORIGINAL = 15; ///< Original map height limit. + static const uint MAP_HEIGHT_LIMIT_AUTO_MINIMUM = 30; ///< When map height limit is auto, make this the lowest possible map height limit. static const uint MAP_HEIGHT_LIMIT_AUTO_CEILING_ROOM = 15; ///< When map height limit is auto, the map height limit will be the higest peak plus this value. diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index dc41a703e3..9a80332e77 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -247,6 +247,7 @@ static void PlaceTreeAtSameHeight(TileIndex tile, int height) void PlaceTreesRandomly() { int i, j, ht; + uint8_t max_height = _settings_game.construction.map_height_limit; i = Map::ScaleBySize(DEFAULT_TREE_STEPS); if (_game_mode == GM_EDITOR) i /= EDITOR_TREE_DIV; @@ -268,6 +269,8 @@ void PlaceTreesRandomly() j = GetTileZ(tile) * 2; /* Above snowline more trees! */ if (_settings_game.game_creation.landscape == LandscapeType::Arctic && ht > GetSnowLine()) j *= 3; + /* Scale generation by maximum map height. */ + if (max_height > MAP_HEIGHT_LIMIT_ORIGINAL) j = j * MAP_HEIGHT_LIMIT_ORIGINAL / max_height; while (j--) { PlaceTreeAtSameHeight(tile, ht); }