From 22d8bfc377d76a1decb8d09a3708d5139bcb7585 Mon Sep 17 00:00:00 2001 From: p2r3 Date: Thu, 28 Aug 2025 13:41:35 +0300 Subject: [PATCH] time chunk generation more accurately --- src/main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main.c b/src/main.c index 35d83f2..6a1b6fe 100644 --- a/src/main.c +++ b/src/main.c @@ -294,15 +294,6 @@ void handlePacket (int client_fd, int length, int packet_id, int state) { player->visited_x[VISITED_HISTORY - 1] = _x; player->visited_z[VISITED_HISTORY - 1] = _z; - sc_setCenterChunk(client_fd, _x, _z); - - int count = 0; - #ifdef DEV_LOG_CHUNK_GENERATION - printf("Sending new chunks (%d, %d)\n", _x, _z); - clock_t start, end; - start = clock(); - #endif - uint32_t r = fast_rand(); // One in every 4 new chunks spawns a mob if ((r & 3) == 0) { @@ -342,6 +333,15 @@ void handlePacket (int client_fd, int length, int packet_id, int state) { } } + int count = 0; + #ifdef DEV_LOG_CHUNK_GENERATION + printf("Sending new chunks (%d, %d)\n", _x, _z); + clock_t start, end; + start = clock(); + #endif + + sc_setCenterChunk(client_fd, _x, _z); + while (dx != 0) { sc_chunkDataAndUpdateLight(client_fd, _x + dx * VIEW_DISTANCE, _z); count ++;