]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/content_mapnode.cpp
src/environment.cpp: Fix NULL pointer dereference
[dragonfireclient.git] / src / content_mapnode.cpp
index cacd7c88f78a5f276f8abcf624a7ad33b8f91be8..5e2a5c816e3361838153a43ca417dd5cc09310c2 100644 (file)
@@ -1,6 +1,6 @@
 /*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
@@ -19,12 +19,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "content_mapnode.h"
 
-#include "irrlichttypes.h"
+#include "irrlichttypes_bloated.h"
 #include "mapnode.h"
 #include "nodedef.h"
-#include "utility.h"
 #include "nameidmapping.h"
-#include <map>
+#include "util/string.h"
 
 /*
        Legacy node content type IDs
@@ -103,23 +102,6 @@ content_t trans_table_19[21][2] = {
        {CONTENT_BOOKSHELF, 29},
 };
 
-MapNode mapnode_translate_from_internal(MapNode n_from, u8 version)
-{
-       MapNode result = n_from;
-       if(version <= 19)
-       {
-               content_t c_from = n_from.getContent();
-               for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
-               {
-                       if(trans_table_19[i][0] == c_from)
-                       {
-                               result.setContent(trans_table_19[i][1]);
-                               break;
-                       }
-               }
-       }
-       return result;
-}
 MapNode mapnode_translate_to_internal(MapNode n_from, u8 version)
 {
        MapNode result = n_from;
@@ -236,14 +218,13 @@ class NewNameGetter
        }
        std::string get(const std::string &old)
        {
-               std::map<std::string, std::string>::const_iterator i;
-               i = old_to_new.find(old);
-               if(i == old_to_new.end())
+               StringMap::const_iterator it = old_to_new.find(old);
+               if (it == old_to_new.end())
                        return "";
-               return i->second;
+               return it->second;
        }
 private:
-       std::map<std::string, std::string> old_to_new;
+       StringMap old_to_new;
 };
 
 NewNameGetter newnamegetter;