mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use min/max instead of clamp for limiting tree count in RMG
Call to `clamp` may not guarantee correct result when `high` < `low`, use calls to `max()` and `min()` explicitly instead.
This commit is contained in:
parent
0398c5d11e
commit
94946ce13b
|
@ -346,7 +346,7 @@ static void mapgen_place_trees()
|
|||
|
||||
// Place trees
|
||||
float treeToLandRatio = (10 + (util_rand() % 30)) / 100.0f;
|
||||
sint32 numTrees = Math::Clamp(4, (sint32) (availablePositions.size() * treeToLandRatio), (sint32)availablePositions.size());
|
||||
sint32 numTrees = std::min(std::max(4, (sint32) (availablePositions.size() * treeToLandRatio)), (sint32)availablePositions.size());
|
||||
|
||||
for (sint32 i = 0; i < numTrees; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue