summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/effectmanager.cpp24
-rw-r--r--src/effectmanager.h2
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.