diff options
-rw-r--r-- | src/resources/db/deaddb.cpp | 17 | ||||
-rw-r--r-- | src/resources/db/deaddb.h | 2 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp index ba4efc8a8..be7c9cade 100644 --- a/src/resources/db/deaddb.cpp +++ b/src/resources/db/deaddb.cpp @@ -35,11 +35,15 @@ namespace void DeadDB::load() { + loadXmlFile(paths.getStringValue("deadMessagesFile")); +} + +void DeadDB::loadXmlFile(const std::string &fileName) +{ if (mLoaded) unload(); - XML::Document *doc = new XML::Document( - paths.getStringValue("deadMessagesFile")); + XML::Document *doc = new XML::Document(fileName); const XmlNodePtr root = doc->rootNode(); if (!root || !xmlNameEqual(root, "messages")) @@ -52,7 +56,14 @@ void DeadDB::load() for_each_xml_child_node(node, root) { - if (xmlNameEqual(node, "message")) + if (xmlNameEqual(node, "include")) + { + const std::string name = XML::getProperty(node, "name", ""); + if (!name.empty()) + loadXmlFile(name); + continue; + } + else if (xmlNameEqual(node, "message")) { const char *const data = reinterpret_cast<const char*>( xmlNodeGetContent(node)); diff --git a/src/resources/db/deaddb.h b/src/resources/db/deaddb.h index 1e47e9c3b..06ed14722 100644 --- a/src/resources/db/deaddb.h +++ b/src/resources/db/deaddb.h @@ -33,6 +33,8 @@ namespace DeadDB */ void load(); + void loadXmlFile(const std::string &fileName); + /** * Clear the chars data */ |