From fc29b17188e556c9e616853ff8f0e0c2cbc2de79 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Fri, 31 Jul 2020 19:27:13 +0200 Subject: [PATCH] [ServerCommandHandler] Small fix. --- source/server/network/ServerCommandHandler.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/server/network/ServerCommandHandler.cpp b/source/server/network/ServerCommandHandler.cpp index 996d658c..e2ed8291 100644 --- a/source/server/network/ServerCommandHandler.cpp +++ b/source/server/network/ServerCommandHandler.cpp @@ -198,9 +198,9 @@ void ServerCommandHandler::setupCallbacks() { Heightmap &heightmap = world.heightmap(); bool hasFoundPosition = false; - for (s32 spawnChunkX = 0 ; spawnChunkX < 16 ; ++spawnChunkX) { - for (s32 spawnChunkY = 0 ; spawnChunkY < 16 ; ++spawnChunkY) { - for(int y = 0 ; y < CHUNK_DEPTH ; y++) { + for (s32 spawnChunkX = 0 ; spawnChunkX < 16 && !hasFoundPosition ; ++spawnChunkX) { + for (s32 spawnChunkY = 0 ; spawnChunkY < 16 && !hasFoundPosition ; ++spawnChunkY) { + for(int y = 0 ; y < CHUNK_DEPTH && !hasFoundPosition ; y++) { for(int x = 0 ; x < CHUNK_WIDTH ; x++) { int maxChunkZ = heightmap.getHighestChunkAt(x + spawnChunkX * CHUNK_WIDTH, y + spawnChunkY * CHUNK_DEPTH); int worldZ = heightmap.getHighestBlockAt(x + spawnChunkX * CHUNK_WIDTH, y + spawnChunkY * CHUNK_DEPTH) + 1; @@ -229,9 +229,6 @@ void ServerCommandHandler::setupCallbacks() { break; } } - - if (hasFoundPosition) - break; } } }