diff options
author | kwolekr <kwolekr@minetest.net> | 2015-05-08 13:31:03 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-05-08 13:31:03 -0400 |
commit | ff740a417946abb003426734645f823458eee9f3 (patch) | |
tree | 5b3f8c3758928f097dd6e3326b35867dadc1d601 /src | |
parent | f1ccfd3c3d7d626087f70b8c5798110cd28b248a (diff) | |
download | minetest-ff740a417946abb003426734645f823458eee9f3.tar.gz minetest-ff740a417946abb003426734645f823458eee9f3.tar.bz2 minetest-ff740a417946abb003426734645f823458eee9f3.zip |
Ensure that Map::findNodesWithMetadata() reports nodes strictly within the node-granular area
Diffstat (limited to 'src')
-rw-r--r-- | src/map.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp index 7f8059cc4..47c66055d 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1898,6 +1898,8 @@ std::vector<v3s16> Map::findNodesWithMetadata(v3s16 p1, v3s16 p2) v3s16 bpmin = getNodeBlockPos(p1); v3s16 bpmax = getNodeBlockPos(p2); + VoxelArea area(p1, p2); + for (s16 z = bpmin.Z; z <= bpmax.Z; z++) for (s16 y = bpmin.Y; y <= bpmax.Y; y++) for (s16 x = bpmin.X; x <= bpmax.X; x++) { @@ -1917,8 +1919,13 @@ std::vector<v3s16> Map::findNodesWithMetadata(v3s16 p1, v3s16 p2) v3s16 p_base = blockpos * MAP_BLOCKSIZE; std::vector<v3s16> keys = block->m_node_metadata.getAllKeys(); - for (size_t i = 0; i != keys.size(); i++) - positions_with_meta.push_back(keys[i] + p_base); + for (size_t i = 0; i != keys.size(); i++) { + v3s16 p(keys[i] + p_base); + if (!area.contains(p)) + continue; + + positions_with_meta.push_back(p); + } } return positions_with_meta; |