]> git.lizzy.rs Git - minetest.git/blobdiff - src/map.h
Make MapEditEvent more complete
[minetest.git] / src / map.h
index 363da6076a420708e5139558c389e0432edd67e5..e049588713fcaacff9b32745a72d1a0c09b4b682 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -79,21 +79,21 @@ struct MapEditEvent
 
        MapEditEvent() = default;
 
+       // Sets the event's position and marks the block as modified.
+       void setPositionModified(v3s16 pos)
+       {
+               p = pos;
+               modified_blocks.insert(getNodeBlockPos(pos));
+       }
+
        VoxelArea getArea() const
        {
                switch(type){
                case MEET_ADDNODE:
-                       return VoxelArea(p);
                case MEET_REMOVENODE:
-                       return VoxelArea(p);
                case MEET_SWAPNODE:
-                       return VoxelArea(p);
                case MEET_BLOCK_NODE_METADATA_CHANGED:
-               {
-                       v3s16 np1 = p*MAP_BLOCKSIZE;
-                       v3s16 np2 = np1 + v3s16(1,1,1)*MAP_BLOCKSIZE - v3s16(1,1,1);
-                       return VoxelArea(np1, np2);
-               }
+                       return VoxelArea(p);
                case MEET_OTHER:
                {
                        VoxelArea a;