1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Don't place trees when impossible

This commit is contained in:
Michał Janiszewski
2017-12-12 23:30:24 +01:00
parent 0aa515355a
commit b47a0f7cb5

View File

@@ -346,7 +346,7 @@ static void mapgen_place_trees()
// Place trees
float treeToLandRatio = (10 + (util_rand() % 30)) / 100.0f;
sint32 numTrees = Math::Max(4, (sint32) (availablePositions.size() * treeToLandRatio));
sint32 numTrees = Math::Clamp(4, (sint32) (availablePositions.size() * treeToLandRatio), (sint32)availablePositions.size());
for (sint32 i = 0; i < numTrees; i++)
{