1
0
mirror of https://github.com/minetest/minetest.git synced 2024-11-11 12:50:38 +01:00

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.
This commit is contained in:
Desour 2024-08-24 13:29:45 +02:00 committed by sfan5
parent 3441fd6e04
commit 04f0a4a1c6

View File

@ -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