Skip to content
Snippets Groups Projects
Commit ff740a41 authored by kwolekr's avatar kwolekr
Browse files

Ensure that Map::findNodesWithMetadata() reports nodes strictly within the node-granular area

parent f1ccfd3c
No related branches found
No related tags found
No related merge requests found
...@@ -1898,6 +1898,8 @@ std::vector<v3s16> Map::findNodesWithMetadata(v3s16 p1, v3s16 p2) ...@@ -1898,6 +1898,8 @@ std::vector<v3s16> Map::findNodesWithMetadata(v3s16 p1, v3s16 p2)
v3s16 bpmin = getNodeBlockPos(p1); v3s16 bpmin = getNodeBlockPos(p1);
v3s16 bpmax = getNodeBlockPos(p2); v3s16 bpmax = getNodeBlockPos(p2);
VoxelArea area(p1, p2);
for (s16 z = bpmin.Z; z <= bpmax.Z; z++) for (s16 z = bpmin.Z; z <= bpmax.Z; z++)
for (s16 y = bpmin.Y; y <= bpmax.Y; y++) for (s16 y = bpmin.Y; y <= bpmax.Y; y++)
for (s16 x = bpmin.X; x <= bpmax.X; x++) { for (s16 x = bpmin.X; x <= bpmax.X; x++) {
...@@ -1917,8 +1919,13 @@ std::vector<v3s16> Map::findNodesWithMetadata(v3s16 p1, v3s16 p2) ...@@ -1917,8 +1919,13 @@ std::vector<v3s16> Map::findNodesWithMetadata(v3s16 p1, v3s16 p2)
v3s16 p_base = blockpos * MAP_BLOCKSIZE; v3s16 p_base = blockpos * MAP_BLOCKSIZE;
std::vector<v3s16> keys = block->m_node_metadata.getAllKeys(); std::vector<v3s16> keys = block->m_node_metadata.getAllKeys();
for (size_t i = 0; i != keys.size(); i++) for (size_t i = 0; i != keys.size(); i++) {
positions_with_meta.push_back(keys[i] + p_base); v3s16 p(keys[i] + p_base);
if (!area.contains(p))
continue;
positions_with_meta.push_back(p);
}
} }
return positions_with_meta; return positions_with_meta;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment