diff options
author | Jude Melton-Houghton <jwmhjwmh@gmail.com> | 2022-12-24 12:21:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 12:21:59 -0500 |
commit | d13b12b791d8a423a9acaeffc44c27edb7cdb95e (patch) | |
tree | 23a66e474c2d3f7a169247675a68fd6bb4535917 /src/map.h | |
parent | 5c248c2d7de3db54e85f7c388743a2eb8e36fee4 (diff) | |
download | minetest-d13b12b791d8a423a9acaeffc44c27edb7cdb95e.tar.xz |
Store `MapEditEvent` blocks in a vector (#13071)
Diffstat (limited to 'src/map.h')
-rw-r--r-- | src/map.h | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -74,7 +74,7 @@ struct MapEditEvent MapEditEventType type = MEET_OTHER; v3s16 p; MapNode n = CONTENT_AIR; - std::set<v3s16> modified_blocks; + std::vector<v3s16> modified_blocks; // Represents a set bool is_private_change = false; MapEditEvent() = default; @@ -82,8 +82,17 @@ struct MapEditEvent // Sets the event's position and marks the block as modified. void setPositionModified(v3s16 pos) { + assert(modified_blocks.empty()); // only meant for initialization (once) p = pos; - modified_blocks.insert(getNodeBlockPos(pos)); + modified_blocks.push_back(getNodeBlockPos(pos)); + } + + void setModifiedBlocks(const std::map<v3s16, MapBlock *> blocks) + { + assert(modified_blocks.empty()); // only meant for initialization (once) + modified_blocks.reserve(blocks.size()); + for (const auto &block : blocks) + modified_blocks.push_back(block.first); } VoxelArea getArea() const |