1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Use fixed starting positions for now.

This commit is contained in:
Tomasz Zieliński
2023-04-10 18:00:23 +02:00
parent 809f6344ff
commit 43c51805f5

View File

@@ -349,10 +349,11 @@ void CZonePlacer::placeOnGrid(CRandomGenerator* rand)
auto zone = grid[x][y]; auto zone = grid[x][y];
if (zone) if (zone)
{ {
auto targetX = rand->nextDouble(x - 0.5f, x + 0.5f); //i.e. for grid size 5 we get range (0.5 - 4.5)
vstd::clamp(targetX, 0, gridSize); auto targetX = rand->nextDouble(x + 0.5f, x + 0.5f);
auto targetY = rand->nextDouble(y - 0.5f, y + 0.5f); vstd::clamp(targetX, 0.5, gridSize - 0.5);
vstd::clamp(targetY, 0, gridSize); 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)); zone->setCenter(float3(targetX / gridSize, targetY / gridSize, zone->getPos().z));
} }