diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-01-31 04:48:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-01-31 16:29:22 +0300 |
commit | 670304fefa71e2b25b264066aaf0d69fde95bced (patch) | |
tree | c949ba1faf68579f0b3c786aac3f69152eec3f15 /src/resources | |
parent | c01b3f215a9ec7e5ebceac8550c1e18c0a2b7435 (diff) | |
download | mv-670304fefa71e2b25b264066aaf0d69fde95bced.tar.gz mv-670304fefa71e2b25b264066aaf0d69fde95bced.tar.bz2 mv-670304fefa71e2b25b264066aaf0d69fde95bced.tar.xz mv-670304fefa71e2b25b264066aaf0d69fde95bced.zip |
Redesing char creation dialog.
Add support for reading all information about hair colors.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/colordb.cpp | 27 | ||||
-rw-r--r-- | src/resources/colordb.h | 4 |
2 files changed, 25 insertions, 6 deletions
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp index 1ffe507b2..bce768d6d 100644 --- a/src/resources/colordb.cpp +++ b/src/resources/colordb.cpp @@ -65,7 +65,7 @@ void ColorDB::loadHair() if (!root || !xmlNameEqual(root, "colors")) { logger->log1("ColorDB: Failed to find any color files."); - mHairColors[0] = mFail; + mHairColors[0] = ItemColor(0, "", ""); mLoaded = true; delete doc; @@ -83,9 +83,8 @@ void ColorDB::loadHair() if (mHairColors.find(id) != mHairColors.end()) logger->log("ColorDB: Redefinition of dye ID %d", id); - mHairColors[id] = hairXml ? - XML::getProperty(node, "value", "#FFFFFF") : - XML::getProperty(node, "dye", "#FFFFFF"); + mHairColors[id] = ItemColor(id, XML::getProperty(node, "name", ""), + XML::getProperty(node, hairXml ? "value" : "dye", "#FFFFFF")); } } @@ -158,7 +157,25 @@ std::string &ColorDB::getHairColor(int id) } else { - return i->second; + return i->second.color; + } +} + +std::string &ColorDB::getHairColorName(int id) +{ + if (!mLoaded) + load(); + + ColorIterator i = mHairColors.find(id); + + if (i == mHairColors.end()) + { + logger->log("ColorDB: Error, unknown dye ID# %d", id); + return mFail; + } + else + { + return i->second.name; } } diff --git a/src/resources/colordb.h b/src/resources/colordb.h index 36907095e..ade4227f8 100644 --- a/src/resources/colordb.h +++ b/src/resources/colordb.h @@ -70,12 +70,14 @@ namespace ColorDB std::string &getHairColor(int id); + std::string &getHairColorName(int id); + int getHairSize(); std::map <int, ItemColor> *getColorsList(std::string name); // Color DB - typedef std::map<int, std::string> Colors; + typedef std::map<int, ItemColor> Colors; typedef Colors::iterator ColorIterator; typedef std::map <std::string, std::map <int, ItemColor> > ColorLists; typedef ColorLists::iterator ColorListsIterator; |