Copyright (C) 2011 Kahrl <kahrl@gmx.net>
This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+GNU Lesser General Public License for more details.
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "tile.h"
#endif
#include "log.h"
-#include "utility.h"
+#include "util/serialize.h"
#include <map>
#include <set>
*def.tool_capabilities);
}
groups = def.groups;
+ node_placement_prediction = def.node_placement_prediction;
#ifndef SERVER
inventory_texture = def.inventory_texture;
if(def.wield_mesh)
}
groups.clear();
+ node_placement_prediction = "";
+
#ifndef SERVER
inventory_texture = NULL;
if(wield_mesh)
os<<serializeString(i->first);
writeS16(os, i->second);
}
+ os<<serializeString(node_placement_prediction);
}
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) {};
}
/*
// Ensure that the "" item (the hand) always has ToolCapabilities
if(def.name == "")
assert(def.tool_capabilities != NULL);
-
- m_item_definitions[def.name] = new ItemDefinition(def);
+
+ if(m_item_definitions.count(def.name) == 0)
+ m_item_definitions[def.name] = new ItemDefinition(def);
+ else
+ *(m_item_definitions[def.name]) = def;
// Remove conflicting alias if it exists
bool alias_removed = (m_aliases.erase(def.name) != 0);
if(def->inventory_texture == NULL)
{
def->inventory_texture =
- tsrc->getTextureRaw(f.tname_tiles[0]);
+ tsrc->getTextureRaw(f.tiledef[0].name);
}
}