summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/statuseffect.cpp20
-rw-r--r--src/statuseffect.h2
2 files changed, 19 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)
diff --git a/src/statuseffect.h b/src/statuseffect.h
index 7c36b48bf..6dda71cfc 100644
--- a/src/statuseffect.h
+++ b/src/statuseffect.h
@@ -105,6 +105,8 @@ public:
static void load();
+ static void loadXmlFile(const std::string &fileName);
+
static void unload();
private:
static bool mLoaded;