]> git.lizzy.rs Git - minetest.git/blobdiff - src/voxel.h
Move `setlocale` from Lua to C++.
[minetest.git] / src / voxel.h
index 88e2edcc76b4e6e04eadaaa04187a19452651cb0..4b53eb85c74084b3aa80beb0e4520eae7ea3bdfa 100644 (file)
@@ -17,13 +17,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef VOXEL_HEADER
-#define VOXEL_HEADER
+#pragma once
 
 #include "irrlichttypes.h"
 #include "irr_v3d.h"
 #include <iostream>
-#include "debug.h"
+#include <cassert>
 #include "exceptions.h"
 #include "mapnode.h"
 #include <set>
@@ -60,7 +59,7 @@ class VoxelArea
 {
 public:
        // Starts as zero sized
-       VoxelArea() {}
+       VoxelArea() = default;
 
        VoxelArea(const v3s16 &min_edge, const v3s16 &max_edge):
                MinEdge(min_edge),
@@ -176,12 +175,12 @@ class VoxelArea
 
        VoxelArea operator+(const v3s16 &off) const
        {
-               return VoxelArea(MinEdge+off, MaxEdge+off);
+               return {MinEdge+off, MaxEdge+off};
        }
 
        VoxelArea operator-(const v3s16 &off) const
        {
-               return VoxelArea(MinEdge-off, MaxEdge-off);
+               return {MinEdge-off, MaxEdge-off};
        }
 
        /*
@@ -345,7 +344,7 @@ enum VoxelPrintMode
 class VoxelManipulator
 {
 public:
-       VoxelManipulator();
+       VoxelManipulator() = default;
        virtual ~VoxelManipulator();
 
        /*
@@ -375,7 +374,7 @@ class VoxelManipulator
                addArea(voxel_area);
 
                if (m_flags[m_area.index(p)] & VOXELFLAG_NO_DATA) {
-                       return MapNode(CONTENT_IGNORE);
+                       return {CONTENT_IGNORE};
                }
 
                return m_data[m_area.index(p)];
@@ -383,9 +382,9 @@ class VoxelManipulator
        MapNode getNodeNoExNoEmerge(const v3s16 &p)
        {
                if (!m_area.contains(p))
-                       return MapNode(CONTENT_IGNORE);
+                       return {CONTENT_IGNORE};
                if (m_flags[m_area.index(p)] & VOXELFLAG_NO_DATA)
-                       return MapNode(CONTENT_IGNORE);
+                       return {CONTENT_IGNORE};
                return m_data[m_area.index(p)];
        }
        // Stuff explodes if non-emerged area is touched with this.
@@ -472,15 +471,6 @@ class VoxelManipulator
 
        void clearFlag(u8 flag);
 
-       // TODO: Move to voxelalgorithms.h
-
-       void unspreadLight(enum LightBank bank, v3s16 p, u8 oldlight,
-                       std::set<v3s16> & light_sources, INodeDefManager *nodemgr);
-
-       void spreadLight(enum LightBank bank, v3s16 p, INodeDefManager *nodemgr);
-       void spreadLight(enum LightBank bank,
-                       std::set<v3s16> & from_nodes, INodeDefManager *nodemgr);
-
        /*
                Member variables
        */
@@ -505,6 +495,3 @@ class VoxelManipulator
 
        static const MapNode ContentIgnoreNode;
 };
-
-#endif
-