Fix: Too many trees when generating trees at same height. (#13460)
Multiplying by tile height caused far too many trees to be generated when using maps higher than the original limit.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user