diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-06 17:16:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-06 17:16:03 +0300 |
commit | 2ba34797598a310bd31d46a43246cf6f88d6db74 (patch) | |
tree | bb9d5fc8394a9c8175f7f7938de48486ef428d81 /src/resources/db/mapdb.cpp | |
parent | dc17affd65b8be94ad24fe440925602475186118 (diff) | |
download | manaplus-2ba34797598a310bd31d46a43246cf6f88d6db74.tar.gz manaplus-2ba34797598a310bd31d46a43246cf6f88d6db74.tar.bz2 manaplus-2ba34797598a310bd31d46a43246cf6f88d6db74.tar.xz manaplus-2ba34797598a310bd31d46a43246cf6f88d6db74.zip |
add support for include in maps.xml.
Diffstat (limited to 'src/resources/db/mapdb.cpp')
-rw-r--r-- | src/resources/db/mapdb.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp index 15c80f2ae..13f671ff4 100644 --- a/src/resources/db/mapdb.cpp +++ b/src/resources/db/mapdb.cpp @@ -46,7 +46,7 @@ void MapDB::load() unload(); loadRemap(); - loadInfo(); + loadInfo(paths.getStringValue("mapsFile")); mLoaded = true; } @@ -125,9 +125,9 @@ void MapDB::readAtlas(XmlNodePtr node) } } -void MapDB::loadInfo() +void MapDB::loadInfo(const std::string &fileName) { - XML::Document *doc = new XML::Document(paths.getStringValue("mapsFile")); + XML::Document *doc = new XML::Document(fileName); const XmlNodePtr root = doc->rootNode(); if (!root) { @@ -138,9 +138,20 @@ void MapDB::loadInfo() for_each_xml_child_node(node, root) { if (xmlNameEqual(node, "map")) + { readMap(node); + } else if (xmlNameEqual(node, "atlas")) + { readAtlas(node); + } + else if (xmlNameEqual(node, "include")) + { + const std::string name = XML::getProperty(node, "name", ""); + if (!name.empty()) + loadInfo(name); + continue; + } } delete doc; } |