summaryrefslogtreecommitdiff
path: root/src/resources/itemdb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-26 14:32:56 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-26 14:32:56 +0300
commit61e3fa8513c1bc2644348ac6052ab87785fb119d (patch)
tree9c889be66d242ac12c382708323e463be9862eef /src/resources/itemdb.cpp
parent41f0e3289d9827ef71b6b76f524b530ff6f3de67 (diff)
downloadManaVerse-61e3fa8513c1bc2644348ac6052ab87785fb119d.tar.gz
ManaVerse-61e3fa8513c1bc2644348ac6052ab87785fb119d.tar.bz2
ManaVerse-61e3fa8513c1bc2644348ac6052ab87785fb119d.tar.xz
ManaVerse-61e3fa8513c1bc2644348ac6052ab87785fb119d.zip
Add support for include tag in items.xml.
Example: <include name="items2.xml"/>
Diffstat (limited to 'src/resources/itemdb.cpp')
-rw-r--r--src/resources/itemdb.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index b4ae544ba..4643b5d76 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -176,8 +176,12 @@ void ItemDB::load()
mUnknown->setSprite(errFile, GENDER_FEMALE, 0);
mUnknown->setSprite(errFile, GENDER_OTHER, 0);
mUnknown->addTag(mTags["All"]);
+ loadXmlFile("items.xml", tagNum);
+}
- XML::Document doc("items.xml");
+void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
+{
+ XML::Document doc(fileName);
const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "items"))
@@ -189,6 +193,13 @@ void ItemDB::load()
for_each_xml_child_node(node, rootNode)
{
+ if (xmlNameEqual(node, "include"))
+ {
+ const std::string name = XML::getProperty(node, "name", "");
+ if (!name.empty())
+ loadXmlFile(name, tagNum);
+ continue;
+ }
if (!xmlNameEqual(node, "item"))
continue;