LuaVoxelManip: Add option to allocate blank data
[oweals/minetest.git] / src / voxel.h
index 033ad3e4564bbf716cd8cb4cf573b2c46041b605..53b6edbc7b9ab649fa2ef64044c60622d1c28bc8 100644 (file)
@@ -80,7 +80,7 @@ public:
                Modifying methods
        */
 
-       void addArea(VoxelArea &a)
+       void addArea(const VoxelArea &a)
        {
                if(getExtent() == v3s16(0,0,0))
                {
@@ -94,7 +94,7 @@ public:
                if(a.MaxEdge.Y > MaxEdge.Y) MaxEdge.Y = a.MaxEdge.Y;
                if(a.MaxEdge.Z > MaxEdge.Z) MaxEdge.Z = a.MaxEdge.Z;
        }
-       void addPoint(v3s16 p)
+       void addPoint(const v3s16 &p)
        {
                if(getExtent() == v3s16(0,0,0))
                {
@@ -111,7 +111,7 @@ public:
        }
 
        // Pad with d nodes
-       void pad(v3s16 d)
+       void pad(const v3s16 &d)
        {
                MinEdge -= d;
                MaxEdge += d;
@@ -366,7 +366,8 @@ public:
        */
        MapNode getNode(v3s16 p)
        {
-               addArea(p);
+               VoxelArea voxel_area(p);
+               addArea(voxel_area);
 
                if(m_flags[m_area.index(p)] & VOXELFLAG_NO_DATA)
                {
@@ -383,7 +384,8 @@ public:
        }
        MapNode getNodeNoEx(v3s16 p)
        {
-               addArea(p);
+               VoxelArea voxel_area(p);
+               addArea(voxel_area);
 
                if(m_flags[m_area.index(p)] & VOXELFLAG_NO_DATA)
                {
@@ -417,7 +419,8 @@ public:
        }
        MapNode & getNodeRef(v3s16 p)
        {
-               addArea(p);
+               VoxelArea voxel_area(p);
+               addArea(voxel_area);
                if(getFlagsRefUnsafe(p) & VOXELFLAG_NO_DATA)
                {
                        /*dstream<<"EXCEPT: VoxelManipulator::getNode(): "
@@ -432,7 +435,8 @@ public:
        }
        void setNode(v3s16 p, const MapNode &n)
        {
-               addArea(p);
+               VoxelArea voxel_area(p);
+               addArea(voxel_area);
 
                m_data[m_area.index(p)] = n;
                m_flags[m_area.index(p)] &= ~VOXELFLAG_NO_DATA;
@@ -499,7 +503,7 @@ public:
        void print(std::ostream &o, INodeDefManager *nodemgr,
                        VoxelPrintMode mode=VOXELPRINT_MATERIAL);
 
-       void addArea(VoxelArea area);
+       void addArea(const VoxelArea &area);
 
        /*
                Copy data and set flags to 0