From 04f0a4a1c6e82d2a649790f9958a1b54426cd45e Mon Sep 17 00:00:00 2001 From: Desour Date: Sat, 24 Aug 2024 13:29:45 +0200 Subject: [PATCH] Fix MeshGrid::isMeshPos() `(1 + 1 + 0) % 2 = 0`, for example, so it had false positives. Only minimap generation uses this function. It did useless work. --- src/util/numeric.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/numeric.h b/src/util/numeric.h index 73b4fb5cd..cfe0317a1 100644 --- a/src/util/numeric.h +++ b/src/util/numeric.h @@ -179,7 +179,9 @@ struct MeshGrid { /// @brief Returns true if p is an origin of a cell in the grid. bool isMeshPos(v3s16 &p) const { - return ((p.X + p.Y + p.Z) % cell_size) == 0; + return p.X % cell_size == 0 + && p.Y % cell_size == 0 + && p.Z % cell_size == 0; } /// @brief Returns index of the given offset in a grid cell