diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-06 16:19:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-06 16:19:38 +0300 |
commit | a3fdbe3f382d11fcb83d7f3c342b676837478821 (patch) | |
tree | 395cc2e18f21fa0fcc8bb24d186015497bce60b8 | |
parent | 9b57c3044aad8edbb46d57963fe0151a0b816afa (diff) | |
download | ManaVerse-a3fdbe3f382d11fcb83d7f3c342b676837478821.tar.gz ManaVerse-a3fdbe3f382d11fcb83d7f3c342b676837478821.tar.bz2 ManaVerse-a3fdbe3f382d11fcb83d7f3c342b676837478821.tar.xz ManaVerse-a3fdbe3f382d11fcb83d7f3c342b676837478821.zip |
add support for include in deadmessages.xml.
-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 */ |