summaryrefslogtreecommitdiff
path: root/src/resources/db/mapdb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-06 17:16:03 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-06 17:16:03 +0300
commit2ba34797598a310bd31d46a43246cf6f88d6db74 (patch)
treebb9d5fc8394a9c8175f7f7938de48486ef428d81 /src/resources/db/mapdb.cpp
parentdc17affd65b8be94ad24fe440925602475186118 (diff)
downloadmanaplus-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.cpp17
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;
}