Noise: Prevent unittest crash caused by division by zero
[oweals/minetest.git] / src / mg_schematic.cpp
index 67931497f34a7e565c3aa5540e89cf037f184c62..c50e90b3a54d35f7abdf2cb7f09f0ee518f81eca 100644 (file)
@@ -37,9 +37,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 
 SchematicManager::SchematicManager(Server *server) :
-       ObjDefManager(server, OBJDEF_SCHEMATIC)
+       ObjDefManager(server, OBJDEF_SCHEMATIC),
+       m_server(server)
 {
-       m_server = server;
 }
 
 
@@ -69,10 +69,6 @@ void SchematicManager::clear()
 
 Schematic::Schematic()
 {
-       schemdata   = NULL;
-       slice_probs = NULL;
-       flags       = 0;
-       size        = v3s16(0, 0, 0);
 }
 
 
@@ -561,14 +557,14 @@ void Schematic::applyProbabilities(v3s16 p0,
 void generate_nodelist_and_update_ids(MapNode *nodes, size_t nodecount,
        std::vector<std::string> *usednodes, INodeDefManager *ndef)
 {
-       UNORDERED_MAP<content_t, content_t> nodeidmap;
+       std::unordered_map<content_t, content_t> nodeidmap;
        content_t numids = 0;
 
        for (size_t i = 0; i != nodecount; i++) {
                content_t id;
                content_t c = nodes[i].getContent();
 
-               UNORDERED_MAP<content_t, content_t>::const_iterator it = nodeidmap.find(c);
+               std::unordered_map<content_t, content_t>::const_iterator it = nodeidmap.find(c);
                if (it == nodeidmap.end()) {
                        id = numids;
                        numids++;