]> git.lizzy.rs Git - minetest.git/commitdiff
Large increase in performance
authorCraig Robbins <kde.psych@gmail.com>
Sun, 21 Dec 2014 15:37:45 +0000 (01:37 +1000)
committerCraig Robbins <kde.psych@gmail.com>
Wed, 24 Dec 2014 13:13:24 +0000 (23:13 +1000)
src/mapnode.h
src/voxel.cpp

index 349739be74b344fcf6d42e8274383f728da3943c..e67724ec1b8af8699cda2bbab3bec8779de5f051 100644 (file)
@@ -143,14 +143,13 @@ struct MapNode
        {
                *this = n;
        }
-       
-       MapNode(content_t content=CONTENT_AIR, u8 a_param1=0, u8 a_param2=0)
-       {
-               param0 = content;
-               param1 = a_param1;
-               param2 = a_param2;
-       }
-       
+
+       MapNode(content_t content = CONTENT_AIR, u8 a_param1=0, u8 a_param2=0)
+               : param0(content),
+                 param1(a_param1),
+                 param2(a_param2)
+       { }
+
        // Create directly from a nodename
        // If name is unknown, sets CONTENT_IGNORE
        MapNode(INodeDefManager *ndef, const std::string &name,
index 335ab307c97f49d00239c211586c9e28eef9ad8a..bd14acb0673e82d7b27471591c50083522e5c4f4 100644 (file)
@@ -180,7 +180,9 @@ void VoxelManipulator::addArea(const VoxelArea &area)
        dstream<<std::endl;*/
 
        // Allocate and clear new data
-       MapNode *new_data = new MapNode[new_size];
+       // 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)];
        assert(new_data);
        u8 *new_flags = new u8[new_size];
        assert(new_flags);