diff options
-rw-r--r-- | src/resources/db/colordb.cpp | 18 | ||||
-rw-r--r-- | src/resources/db/colordb.h | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp index d4828cc75..d94ac8bce 100644 --- a/src/resources/db/colordb.cpp +++ b/src/resources/db/colordb.cpp @@ -51,7 +51,7 @@ void ColorDB::load() mColorLists["hair"] = colors; if (serverVersion >= 1) - loadColorLists(); + loadColorLists(paths.getStringValue("itemColorsFile")); it = mColorLists.find("hair"); if (it != mColorLists.end()) @@ -86,7 +86,7 @@ void ColorDB::loadHair(const std::string &fileName, loadHair(name, colors); continue; } - if (xmlNameEqual(node, "color")) + else if (xmlNameEqual(node, "color")) { const int id = XML::getProperty(node, "id", 0); @@ -101,10 +101,9 @@ void ColorDB::loadHair(const std::string &fileName, delete doc; } -void ColorDB::loadColorLists() +void ColorDB::loadColorLists(const std::string &fileName) { - XML::Document *doc = new XML::Document( - paths.getStringValue("itemColorsFile")); + XML::Document *doc = new XML::Document(fileName); const XmlNodePtr root = doc->rootNode(); if (!root) { @@ -114,7 +113,14 @@ void ColorDB::loadColorLists() for_each_xml_child_node(node, root) { - if (xmlNameEqual(node, "list")) + if (xmlNameEqual(node, "include")) + { + const std::string name = XML::getProperty(node, "name", ""); + if (!name.empty()) + loadColorLists(name); + continue; + } + else if (xmlNameEqual(node, "list")) { const std::string name = XML::getProperty(node, "name", ""); if (name.empty()) diff --git a/src/resources/db/colordb.h b/src/resources/db/colordb.h index d940ef772..d1fc1a420 100644 --- a/src/resources/db/colordb.h +++ b/src/resources/db/colordb.h @@ -65,7 +65,7 @@ namespace ColorDB void loadHair(const std::string &fileName, std::map<int, ItemColor> &colors); - void loadColorLists(); + void loadColorLists(const std::string &fileName); /** * Clear the color data |