diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-06 18:57:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-06 18:57:54 +0300 |
commit | cc2142b0daaddbe76f4ba139c7d953f8beb0dd72 (patch) | |
tree | 37e4bff8547ae224c892f62e1347f425201cb10e /src | |
parent | e133b490e49acbfacf9ef86b50338ba923ed6a2f (diff) | |
download | manaplus-cc2142b0daaddbe76f4ba139c7d953f8beb0dd72.tar.gz manaplus-cc2142b0daaddbe76f4ba139c7d953f8beb0dd72.tar.bz2 manaplus-cc2142b0daaddbe76f4ba139c7d953f8beb0dd72.tar.xz manaplus-cc2142b0daaddbe76f4ba139c7d953f8beb0dd72.zip |
add support for include in effects.xml.
Diffstat (limited to 'src')
-rw-r--r-- | src/effectmanager.cpp | 24 | ||||
-rw-r--r-- | src/effectmanager.h | 2 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index 6790cf61f..17ef70508 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -35,23 +35,31 @@ EffectManager::EffectManager() : mEffects() { - XML::Document doc(paths.getStringValue("effectsFile")); + logger->log1("Effects are now loading"); + loadXmlFile(paths.getStringValue("effectsFile")); +} + +void EffectManager::loadXmlFile(const std::string &fileName) +{ + XML::Document doc(fileName); const XmlNodePtr root = doc.rootNode(); if (!root || !xmlNameEqual(root, "being-effects")) { - logger->log("Error loading being effects file: " - + paths.getStringValue("effectsFile")); + logger->log("Error loading being effects file: " + fileName); return; } - else - { - logger->log1("Effects are now loading"); - } for_each_xml_child_node(node, root) { - if (xmlNameEqual(node, "effect")) + if (xmlNameEqual(node, "include")) + { + const std::string name = XML::getProperty(node, "name", ""); + if (!name.empty()) + loadXmlFile(name); + continue; + } + else if (xmlNameEqual(node, "effect")) { mEffects.push_back(EffectDescription( XML::getProperty(node, "id", -1), diff --git a/src/effectmanager.h b/src/effectmanager.h index 57181a750..f31027269 100644 --- a/src/effectmanager.h +++ b/src/effectmanager.h @@ -57,6 +57,8 @@ class EffectManager final ~EffectManager(); + void loadXmlFile(const std::string &fileName); + /** * Triggers a effect with the id, at * the specified being. |