summaryrefslogtreecommitdiff
path: root/src/resources/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/db')
-rw-r--r--src/resources/db/colordb.cpp30
-rw-r--r--src/resources/db/colordb.h3
2 files changed, 20 insertions, 13 deletions
diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp
index e3ab56672..d4828cc75 100644
--- a/src/resources/db/colordb.cpp
+++ b/src/resources/db/colordb.cpp
@@ -43,11 +43,17 @@ void ColorDB::load()
if (mLoaded)
unload();
- loadHair();
+ std::map<int, ItemColor> colors;
+ ColorListsIterator it = mColorLists.find("hair");
+ if (it != mColorLists.end())
+ colors = it->second;
+ loadHair(paths.getStringValue("hairColorFile"), colors);
+ mColorLists["hair"] = colors;
+
if (serverVersion >= 1)
loadColorLists();
- const ColorListsIterator it = mColorLists.find("hair");
+ it = mColorLists.find("hair");
if (it != mColorLists.end())
mHairColorsSize = static_cast<int>((*it).second.size());
else
@@ -55,16 +61,10 @@ void ColorDB::load()
mLoaded = true;
}
-void ColorDB::loadHair()
+void ColorDB::loadHair(const std::string &fileName,
+ std::map<int, ItemColor> &colors)
{
- std::map <int, ItemColor> colors;
- const ColorListsIterator it = mColorLists.find("hair");
-
- if (it != mColorLists.end())
- colors = it->second;
-
- XML::Document *doc = new XML::Document(
- paths.getStringValue("hairColorFile"));
+ XML::Document *doc = new XML::Document(fileName);
XmlNodePtr root = doc->rootNode();
bool hairXml = true;
@@ -79,6 +79,13 @@ void ColorDB::loadHair()
for_each_xml_child_node(node, root)
{
+ if (xmlNameEqual(node, "include"))
+ {
+ const std::string name = XML::getProperty(node, "name", "");
+ if (!name.empty())
+ loadHair(name, colors);
+ continue;
+ }
if (xmlNameEqual(node, "color"))
{
const int id = XML::getProperty(node, "id", 0);
@@ -92,7 +99,6 @@ void ColorDB::loadHair()
}
delete doc;
- mColorLists["hair"] = colors;
}
void ColorDB::loadColorLists()
diff --git a/src/resources/db/colordb.h b/src/resources/db/colordb.h
index e466102f9..d940ef772 100644
--- a/src/resources/db/colordb.h
+++ b/src/resources/db/colordb.h
@@ -62,7 +62,8 @@ namespace ColorDB
/**
* Loads the color data from <code>colors.xml</code>.
*/
- void loadHair();
+ void loadHair(const std::string &fileName,
+ std::map<int, ItemColor> &colors);
void loadColorLists();