From b47a0f7cb57b514cbf7f93f154630c3f7f435e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 12 Dec 2017 23:30:24 +0100 Subject: [PATCH] Don't place trees when impossible --- src/openrct2/world/MapGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/world/MapGen.cpp b/src/openrct2/world/MapGen.cpp index a0d84a1b4c..9f31d48b3e 100644 --- a/src/openrct2/world/MapGen.cpp +++ b/src/openrct2/world/MapGen.cpp @@ -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++) {