mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-15 01:25:20 +02:00
Store MapEditEvent
blocks in a vector (#13071)
This commit is contained in:
committed by
GitHub
parent
5c248c2d7d
commit
d13b12b791
13
src/map.h
13
src/map.h
@@ -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
|
||||
|
Reference in New Issue
Block a user