summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/resources/db/avatardb.cpp16
-rw-r--r--src/resources/db/avatardb.h4
2 files changed, 18 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;
diff --git a/src/resources/db/avatardb.h b/src/resources/db/avatardb.h
index 0b4894c9c..f86ac4882 100644
--- a/src/resources/db/avatardb.h
+++ b/src/resources/db/avatardb.h
@@ -23,6 +23,8 @@
#ifndef RESOURCES_DB_AVATARDB_H
#define RESOURCES_DB_AVATARDB_H
+#include <string>
+
#include "localconsts.h"
class BeingInfo;
@@ -34,6 +36,8 @@ namespace AvatarDB
void unload();
BeingInfo *get(const int id) A_WARN_UNUSED;
+
+ void loadXmlFile(const std::string &fileName);
}
#endif // RESOURCES_DB_AVATARDB_H