summaryrefslogtreecommitdiff
path: root/src/itemdef.cpp
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2016-12-22 23:16:00 +0100
committerest31 <MTest31@outlook.com>2016-12-22 23:16:00 +0100
commit81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (patch)
tree1e9ef1be1b3295a8673d6e4f0bdeb4c2d3a6015f /src/itemdef.cpp
parent8077612dcb48221281e726a60eb97bf73fde462b (diff)
parent231ac33d34dfaaddf292c5f31b1eae43eeefba2d (diff)
downloadminetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.tar.gz
minetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.tar.bz2
minetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.zip
Merge 0.4.15 changes into stable-0.4
0.4.15 release!
Diffstat (limited to 'src/itemdef.cpp')
-rw-r--r--src/itemdef.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/itemdef.cpp b/src/itemdef.cpp
index a618ad631..1aa6331dc 100644
--- a/src/itemdef.cpp
+++ b/src/itemdef.cpp
@@ -146,9 +146,9 @@ void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const
}
os<<serializeString(tool_capabilities_s);
writeU16(os, groups.size());
- for(std::map<std::string, int>::const_iterator
+ for (ItemGroupList::const_iterator
i = groups.begin(); i != groups.end(); ++i){
- os<<serializeString(i->first);
+ os << serializeString(i->first);
writeS16(os, i->second);
}
os<<serializeString(node_placement_prediction);
@@ -466,11 +466,17 @@ public:
infostream<<"ItemDefManager: erased alias "<<def.name
<<" because item was defined"<<std::endl;
}
+ virtual void unregisterItem(const std::string &name)
+ {
+ verbosestream<<"ItemDefManager: unregistering \""<<name<<"\""<<std::endl;
+
+ delete m_item_definitions[name];
+ m_item_definitions.erase(name);
+ }
virtual void registerAlias(const std::string &name,
const std::string &convert_to)
{
- if(m_item_definitions.find(name) == m_item_definitions.end())
- {
+ if (m_item_definitions.find(name) == m_item_definitions.end()) {
verbosestream<<"ItemDefManager: setting alias "<<name
<<" -> "<<convert_to<<std::endl;
m_aliases[name] = convert_to;