]> git.lizzy.rs Git - minetest.git/blobdiff - src/itemdef.cpp
Add shutdown hook interface to Lua API
[minetest.git] / src / itemdef.cpp
index fc0942c470d576de364e116f66f8be82bf2d56d8..da33fd32295daae5fceb2c4e6c6f3d1159337ddd 100644 (file)
@@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "tile.h"
 #endif
 #include "log.h"
-#include "utility.h"
+#include "util/serialize.h"
 #include <map>
 #include <set>
 
@@ -70,6 +70,7 @@ ItemDefinition& ItemDefinition::operator=(const ItemDefinition &def)
                                *def.tool_capabilities);
        }
        groups = def.groups;
+       node_placement_prediction = def.node_placement_prediction;
 #ifndef SERVER
        inventory_texture = def.inventory_texture;
        if(def.wield_mesh)
@@ -115,6 +116,8 @@ void ItemDefinition::reset()
        }
        groups.clear();
 
+       node_placement_prediction = "";
+       
 #ifndef SERVER
        inventory_texture = NULL;
        if(wield_mesh)
@@ -150,6 +153,7 @@ void ItemDefinition::serialize(std::ostream &os) const
                os<<serializeString(i->first);
                writeS16(os, i->second);
        }
+       os<<serializeString(node_placement_prediction);
 }
 
 void ItemDefinition::deSerialize(std::istream &is)
@@ -184,6 +188,11 @@ void ItemDefinition::deSerialize(std::istream &is)
                int value = readS16(is);
                groups[name] = value;
        }
+       // If you add anything here, insert it primarily inside the try-catch
+       // block to not need to increase the version.
+       try{
+               node_placement_prediction = deSerializeString(is);
+       }catch(SerializationError &e) {};
 }
 
 /*
@@ -442,7 +451,7 @@ class CItemDefManager: public IWritableItemDefManager
                                        if(def->inventory_texture == NULL)
                                        {
                                                def->inventory_texture =
-                                                       tsrc->getTextureRaw(f.tname_tiles[0]);
+                                                       tsrc->getTextureRaw(f.tiledef[0].name);
                                        }
                                }