diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-06 16:06:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-06 16:06:41 +0300 |
commit | 9b57c3044aad8edbb46d57963fe0151a0b816afa (patch) | |
tree | 88cc1dad99e3a9196dd841652f28620d4a1cb6c5 /src/resources/db | |
parent | 4c4ceabb105079fdf389e0c63d106e1d1e21b0c5 (diff) | |
download | manaverse-9b57c3044aad8edbb46d57963fe0151a0b816afa.tar.gz manaverse-9b57c3044aad8edbb46d57963fe0151a0b816afa.tar.bz2 manaverse-9b57c3044aad8edbb46d57963fe0151a0b816afa.tar.xz manaverse-9b57c3044aad8edbb46d57963fe0151a0b816afa.zip |
add include support in itemcolors.xml.
Diffstat (limited to 'src/resources/db')
-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 |