summaryrefslogtreecommitdiff
path: root/src/resources
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
parentdc17affd65b8be94ad24fe440925602475186118 (diff)
downloadmanaverse-2ba34797598a310bd31d46a43246cf6f88d6db74.tar.gz
manaverse-2ba34797598a310bd31d46a43246cf6f88d6db74.tar.bz2
manaverse-2ba34797598a310bd31d46a43246cf6f88d6db74.tar.xz
manaverse-2ba34797598a310bd31d46a43246cf6f88d6db74.zip
add support for include in maps.xml.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/mapdb.cpp17
-rw-r--r--src/resources/db/mapdb.h2
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