summaryrefslogtreecommitdiff
path: root/src/resources/db/avatardb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-06 15:01:55 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-06 15:01:55 +0300
commit9c83e992d7f7b0a53e102df6265066fc25141dfa (patch)
treeef4102273b9b9f626e16ef41ba07549809b67c82 /src/resources/db/avatardb.cpp
parentb7ee14cadb1e5675f7e36565aec1fe39e55ccc34 (diff)
downloadmanaverse-9c83e992d7f7b0a53e102df6265066fc25141dfa.tar.gz
manaverse-9c83e992d7f7b0a53e102df6265066fc25141dfa.tar.bz2
manaverse-9c83e992d7f7b0a53e102df6265066fc25141dfa.tar.xz
manaverse-9c83e992d7f7b0a53e102df6265066fc25141dfa.zip
Add support for include in avatars.xml.
Diffstat (limited to 'src/resources/db/avatardb.cpp')
-rw-r--r--src/resources/db/avatardb.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp
index 8ff58efc5..100803a2a 100644
--- a/src/resources/db/avatardb.cpp
+++ b/src/resources/db/avatardb.cpp
@@ -43,20 +43,32 @@ void AvatarDB::load()
{
if (mLoaded)
unload();
+ loadXmlFile(paths.getStringValue("avatarsFile"));
+}
- XML::Document doc(paths.getStringValue("avatarsFile"));
+void AvatarDB::loadXmlFile(const std::string &fileName)
+{
+ XML::Document doc(fileName);
const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "avatars"))
{
logger->log("Avatars Database: Error while loading %s!",
- paths.getStringValue("avatarsFile").c_str());
+ fileName.c_str());
mLoaded = true;
return;
}
for_each_xml_child_node(avatarNode, rootNode)
{
+ if (xmlNameEqual(avatarNode, "include"))
+ {
+ const std::string name = XML::getProperty(avatarNode, "name", "");
+ if (!name.empty())
+ loadXmlFile(name);
+ continue;
+ }
+
if (!xmlNameEqual(avatarNode, "avatar"))
continue;