]> git.lizzy.rs Git - minetest.git/blobdiff - src/voxel.h
Rework escape/pause menu (#5719)
[minetest.git] / src / voxel.h
index 52274ac19d4479960005ead8e9c8d5628aae4466..58ad39be4a890d7f1fe6fe4ab1db6519dd4a024f 100644 (file)
@@ -213,7 +213,7 @@ class VoxelArea
                        return;
                }
 
-               assert(contains(a));
+               assert(contains(a));    // pre-condition
 
                // Take back area, XY inclusive
                {
@@ -413,10 +413,21 @@ class VoxelManipulator /*: public NodeContainer*/
        }
        // Stuff explodes if non-emerged area is touched with this.
        // Emerge first, and check VOXELFLAG_NO_DATA if appropriate.
-       MapNode & getNodeRefUnsafe(v3s16 p)
+       MapNode & getNodeRefUnsafe(const v3s16 &p)
        {
                return m_data[m_area.index(p)];
        }
+
+       const MapNode & getNodeRefUnsafeCheckFlags(const v3s16 &p)
+       {
+               s32 index = m_area.index(p);
+
+               if (m_flags[index] & VOXELFLAG_NO_DATA)
+                       return ContentIgnoreNode;
+
+               return m_data[index];
+       }
+
        u8 & getFlagsRefUnsafe(v3s16 p)
        {
                return m_flags[m_area.index(p)];
@@ -569,6 +580,8 @@ class VoxelManipulator /*: public NodeContainer*/
        */
        u8 *m_flags;
 
+       static const MapNode ContentIgnoreNode;
+
        //TODO: Use these or remove them
        //TODO: Would these make any speed improvement?
        //bool m_pressure_route_valid;