diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-06 18:50:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-06 18:50:29 +0300 |
commit | e133b490e49acbfacf9ef86b50338ba923ed6a2f (patch) | |
tree | d236f8712cdf44cc0ee8427932a7e0dfcefe5f18 /src/statuseffect.cpp | |
parent | c79af51bea401a358764791b0e2e1d7c75a4adc1 (diff) | |
download | mv-e133b490e49acbfacf9ef86b50338ba923ed6a2f.tar.gz mv-e133b490e49acbfacf9ef86b50338ba923ed6a2f.tar.bz2 mv-e133b490e49acbfacf9ef86b50338ba923ed6a2f.tar.xz mv-e133b490e49acbfacf9ef86b50338ba923ed6a2f.zip |
add support for include in status-effects.xml.
Diffstat (limited to 'src/statuseffect.cpp')
-rw-r--r-- | src/statuseffect.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 018fe39ec..be173b023 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -127,17 +127,32 @@ void StatusEffect::load() if (mLoaded) unload(); - XML::Document doc(paths.getStringValue("statusEffectsFile")); + loadXmlFile(paths.getStringValue("statusEffectsFile")); + + mLoaded = true; +} + +void StatusEffect::loadXmlFile(const std::string &fileName) +{ + XML::Document doc(fileName); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "status-effects")) { - logger->log1("Error loading status effects file"); + logger->log("Error loading status effects file: " + fileName); return; } for_each_xml_child_node(node, rootNode) { + if (xmlNameEqual(node, "include")) + { + const std::string name = XML::getProperty(node, "name", ""); + if (!name.empty()) + loadXmlFile(name); + continue; + } + status_effect_map *the_map = nullptr; const int index = atoi(XML::getProperty(node, "id", "-1").c_str()); @@ -182,7 +197,6 @@ void StatusEffect::load() (*the_map)[0][index] = endEffect; } } - mLoaded = true; } static void unloadMap(std::map<int, StatusEffect *> &map) |