summaryrefslogtreecommitdiff
path: root/src/effectmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-06 18:57:54 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-06 18:57:54 +0300
commitcc2142b0daaddbe76f4ba139c7d953f8beb0dd72 (patch)
tree37e4bff8547ae224c892f62e1347f425201cb10e /src/effectmanager.cpp
parente133b490e49acbfacf9ef86b50338ba923ed6a2f (diff)
downloadplus-cc2142b0daaddbe76f4ba139c7d953f8beb0dd72.tar.gz
plus-cc2142b0daaddbe76f4ba139c7d953f8beb0dd72.tar.bz2
plus-cc2142b0daaddbe76f4ba139c7d953f8beb0dd72.tar.xz
plus-cc2142b0daaddbe76f4ba139c7d953f8beb0dd72.zip
add support for include in effects.xml.
Diffstat (limited to 'src/effectmanager.cpp')
-rw-r--r--src/effectmanager.cpp24
1 files changed, 16 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),