From a1f094776ffee34ec2abda96c44db472c400697d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zieli=C5=84ski?= Date: Mon, 10 Apr 2023 18:00:23 +0200 Subject: [PATCH] Use fixed starting positions for now. (cherry picked from commit 43c51805f5a86cf2589251d3e36b6bdef3f0626f) --- lib/rmg/CZonePlacer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/rmg/CZonePlacer.cpp b/lib/rmg/CZonePlacer.cpp index fe72425e1..8c185a10e 100644 --- a/lib/rmg/CZonePlacer.cpp +++ b/lib/rmg/CZonePlacer.cpp @@ -349,10 +349,11 @@ void CZonePlacer::placeOnGrid(CRandomGenerator* rand) auto zone = grid[x][y]; if (zone) { - auto targetX = rand->nextDouble(x - 0.5f, x + 0.5f); - vstd::clamp(targetX, 0, gridSize); - auto targetY = rand->nextDouble(y - 0.5f, y + 0.5f); - vstd::clamp(targetY, 0, gridSize); + //i.e. for grid size 5 we get range (0.5 - 4.5) + auto targetX = rand->nextDouble(x + 0.5f, x + 0.5f); + vstd::clamp(targetX, 0.5, gridSize - 0.5); + auto targetY = rand->nextDouble(y + 0.5f, y + 0.5f); + vstd::clamp(targetY, 0.5, gridSize - 0.5); zone->setCenter(float3(targetX / gridSize, targetY / gridSize, zone->getPos().z)); }