1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 20:13:07 +01:00

Fix implicit floating point cast imprecision error

This commit is contained in:
Hielke Morsink
2022-04-30 00:51:52 +02:00
committed by GitHub
parent 7471cb319f
commit ad61343a83

View File

@@ -364,7 +364,8 @@ static void mapgen_place_trees()
}
// Use tree:land ratio except when near an oasis
if (static_cast<float>(util_rand()) / 0xFFFFFFFF > std::max(treeToLandRatio, oasisScore))
constexpr static auto randModulo = 0xFFFF;
if (static_cast<float>(util_rand() & randModulo) / randModulo > std::max(treeToLandRatio, oasisScore))
continue;
// Use fractal noise to group tiles that are likely to spawn trees together