From 65fa378e21ae7ebf91a5c7151ad12978cfc79538 Mon Sep 17 00:00:00 2001 From: bjoel2 Date: Thu, 18 Jan 2024 15:47:22 +0300 Subject: [PATCH] smarter isChunkInRange check --- Util.cpp | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/Util.cpp b/Util.cpp index febd69a..d2f5842 100644 --- a/Util.cpp +++ b/Util.cpp @@ -13,7 +13,7 @@ bool isSlimeChunk(const GlobalSeedMatrix& matrix, const uint32_t matrixX, const uint32_t getChunkScore(const uint32_t x, const uint32_t z) { - const uint32_t matrix[16][16] = + const uint32_t scoreMatrix[16][16] = { { 0, 0, 0, 0, 755, 3681, 5795, 6834, 6834, 5795, 3681, 755, 0, 0, 0, 0}, { 0, 0, 0, 3588, 7552, 7936, 7936, 7936, 7936, 7936, 7936, 7552, 3588, 0, 0, 0}, @@ -32,31 +32,12 @@ uint32_t getChunkScore(const uint32_t x, const uint32_t z) { 0, 0, 0, 3588, 7552, 7936, 7936, 7936, 7936, 7936, 7936, 7552, 3588, 0, 0, 0}, { 0, 0, 0, 0, 755, 3681, 5795, 6834, 6834, 5795, 3681, 755, 0, 0, 0, 0}, }; - return matrix[z][x]; + return scoreMatrix[z][x]; } bool isChunkWithinSphere(const uint32_t x, const uint32_t z) { - const uint32_t matrix[16][16] = - { - {0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}, - {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, - {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, - {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, - {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, - {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, - {0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}, - }; - return matrix[z][x]; + return getChunkScore(x, z) != 0; } }