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 | |
parent | dc17affd65b8be94ad24fe440925602475186118 (diff) | |
download | mv-2ba34797598a310bd31d46a43246cf6f88d6db74.tar.gz mv-2ba34797598a310bd31d46a43246cf6f88d6db74.tar.bz2 mv-2ba34797598a310bd31d46a43246cf6f88d6db74.tar.xz mv-2ba34797598a310bd31d46a43246cf6f88d6db74.zip |
add support for include in maps.xml.
Diffstat (limited to 'src/resources/db')
-rw-r--r-- | src/resources/db/mapdb.cpp | 17 | ||||
-rw-r--r-- | src/resources/db/mapdb.h | 2 |
2 files changed, 15 insertions, 4 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; } diff --git a/src/resources/db/mapdb.h b/src/resources/db/mapdb.h index 527d15ba4..c2fbb3137 100644 --- a/src/resources/db/mapdb.h +++ b/src/resources/db/mapdb.h @@ -52,7 +52,7 @@ namespace MapDB void loadRemap(); - void loadInfo(); + void loadInfo(const std::string &fileName); /** * Clear the remap data |