]> git.lizzy.rs Git - minetest.git/blobdiff - src/voxel.cpp
Fix usage of destroyed mutex
[minetest.git] / src / voxel.cpp
index 1299a5296da9c5eef0d25e243b6f2ca721f5e052..a5e0b09fe7517ce334050a29fa7259329021289a 100644 (file)
@@ -139,7 +139,7 @@ void VoxelManipulator::print(std::ostream &o, INodeDefManager *ndef,
 void VoxelManipulator::addArea(const VoxelArea &area)
 {
        // Cancel if requested area has zero volume
-       if(area.getExtent() == v3s16(0,0,0))
+       if (area.hasEmptyExtent())
                return;
 
        // Cancel if m_area already contains the requested area
@@ -151,7 +151,7 @@ void VoxelManipulator::addArea(const VoxelArea &area)
        // Calculate new area
        VoxelArea new_area;
        // New area is the requested area if m_area has zero volume
-       if(m_area.getExtent() == v3s16(0,0,0))
+       if(m_area.hasEmptyExtent())
        {
                new_area = area;
        }
@@ -173,10 +173,8 @@ void VoxelManipulator::addArea(const VoxelArea &area)
        dstream<<", new_size="<<new_size;
        dstream<<std::endl;*/
 
-       // Allocate and clear new data
-       // FIXME: UGLY KLUDGE because MapNode default constructor is FUBAR; it
-       //        initialises data that is going to be overwritten anyway
-       MapNode *new_data = (MapNode*)new char[new_size * sizeof (*new_data)];
+       // Allocate new data and clear flags
+       MapNode *new_data = new MapNode[new_size];
        assert(new_data);
        u8 *new_flags = new u8[new_size];
        assert(new_flags);
@@ -623,6 +621,8 @@ void VoxelManipulator::spreadLight(enum LightBank bank,
 }
 #endif
 
+const MapNode VoxelManipulator::ContentIgnoreNode = MapNode(CONTENT_IGNORE);
+
 #if 1
 /*
        Lights neighbors of from_nodes, collects all them and then