diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-06 19:10:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-06 19:10:41 +0300 |
commit | c2177ba1356a268d1edbec316870821fa0578fdd (patch) | |
tree | 29820599afc31a83943d6581c0a58f0ac8b74943 /src/gui | |
parent | 5007515135c05104a6b0e5b7991de310f53ce8ce (diff) | |
download | manaverse-c2177ba1356a268d1edbec316870821fa0578fdd.tar.gz manaverse-c2177ba1356a268d1edbec316870821fa0578fdd.tar.bz2 manaverse-c2177ba1356a268d1edbec316870821fa0578fdd.tar.xz manaverse-c2177ba1356a268d1edbec316870821fa0578fdd.zip |
add support for include in quests.xml.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/windows/questswindow.cpp | 15 | ||||
-rw-r--r-- | src/gui/windows/questswindow.h | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 0cd04dbc1..ec40f759f 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -181,7 +181,7 @@ QuestsWindow::QuestsWindow() : loadWindowState(); enableVisibleSound(true); - loadXml(); + loadXmlFile(paths.getStringValue("questsFile")); } QuestsWindow::~QuestsWindow() @@ -218,16 +218,23 @@ QuestsWindow::~QuestsWindow() } } -void QuestsWindow::loadXml() +void QuestsWindow::loadXmlFile(const std::string &fileName) { - XML::Document doc(paths.getStringValue("questsFile")); + XML::Document doc(fileName); const XmlNodePtr root = doc.rootNode(); if (!root) return; for_each_xml_child_node(varNode, root) { - if (xmlNameEqual(varNode, "var")) + if (xmlNameEqual(varNode, "include")) + { + const std::string name = XML::getProperty(varNode, "name", ""); + if (!name.empty()) + loadXmlFile(name); + continue; + } + else if (xmlNameEqual(varNode, "var")) { const int id = XML::getProperty(varNode, "id", 0); if (id < 0) diff --git a/src/gui/windows/questswindow.h b/src/gui/windows/questswindow.h index 5b008e93e..7ecc86c84 100644 --- a/src/gui/windows/questswindow.h +++ b/src/gui/windows/questswindow.h @@ -72,7 +72,7 @@ class QuestsWindow final : public Window, void addEffect(Being *const being); private: - void loadXml(); + void loadXmlFile(const std::string &fileName); void loadQuest(const int var, const XmlNodePtr node); |