From 33eb28b570e132f63d7aaa451a732f3d0c9a10d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zieli=C5=84ski?= Date: Mon, 17 Apr 2023 15:09:08 +0200 Subject: [PATCH] Randomize starting positions a bit so zones don't fall exactly on the grid. --- lib/rmg/CZonePlacer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rmg/CZonePlacer.cpp b/lib/rmg/CZonePlacer.cpp index 9a76c7527..d5b733902 100644 --- a/lib/rmg/CZonePlacer.cpp +++ b/lib/rmg/CZonePlacer.cpp @@ -276,10 +276,10 @@ void CZonePlacer::placeOnGrid(CRandomGenerator* rand) if (zone) { //i.e. for grid size 5 we get range (0.5 - 4.5) - auto targetX = rand->nextDouble(x + 0.5f, x + 0.5f); - std::clamp(targetX, 0.5, gridSize - 0.5); - auto targetY = rand->nextDouble(y + 0.5f, y + 0.5f); - std::clamp(targetY, 0.5, gridSize - 0.5); + auto targetX = rand->nextDouble(x + 0.25f, x + 0.75f); + vstd::abetween(targetX, 0.5, gridSize - 0.5); + auto targetY = rand->nextDouble(y + 0.25f, y + 0.75f); + vstd::abetween(targetY, 0.5, gridSize - 0.5); zone->setCenter(float3(targetX / gridSize, targetY / gridSize, zone->getPos().z)); }