diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-06 18:19:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-06 18:19:20 +0300 |
commit | f55d6f7c27db71b7327d4de4ee294bcaf7b82f6b (patch) | |
tree | a65ae6d75b7cf43eab60fc7ede6cb8a2cc722f33 /src/resources/db/sounddb.cpp | |
parent | d8f56c2b9a68de7bba8f5848b126bd25741eb494 (diff) | |
download | mv-f55d6f7c27db71b7327d4de4ee294bcaf7b82f6b.tar.gz mv-f55d6f7c27db71b7327d4de4ee294bcaf7b82f6b.tar.bz2 mv-f55d6f7c27db71b7327d4de4ee294bcaf7b82f6b.tar.xz mv-f55d6f7c27db71b7327d4de4ee294bcaf7b82f6b.zip |
add support for include in sounds.xml.
Diffstat (limited to 'src/resources/db/sounddb.cpp')
-rw-r--r-- | src/resources/db/sounddb.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp index 639156909..ca7d0d654 100644 --- a/src/resources/db/sounddb.cpp +++ b/src/resources/db/sounddb.cpp @@ -37,8 +37,12 @@ namespace void SoundDB::load() { unload(); + loadXmlFile(paths.getStringValue("soundsFile")); +} - XML::Document *doc = new XML::Document(paths.getStringValue("soundsFile")); +void SoundDB::loadXmlFile(const std::string &fileName) +{ + XML::Document *doc = new XML::Document(fileName); const XmlNodePtr root = doc->rootNode(); if (!root || !xmlNameEqual(root, "sounds")) @@ -49,7 +53,14 @@ void SoundDB::load() for_each_xml_child_node(node, root) { - if (xmlNameEqual(node, "sound")) + if (xmlNameEqual(node, "include")) + { + const std::string name = XML::getProperty(node, "name", ""); + if (!name.empty()) + loadXmlFile(name); + continue; + } + else if (xmlNameEqual(node, "sound")) { const std::string name = XML::getProperty(node, "name", ""); const int id = NotifyManager::getIndexBySound(name); |