diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-03 01:25:21 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-03 01:25:21 +0200 |
commit | 22f79fd0d623c8e11994905534f53da267e22935 (patch) | |
tree | 04403929ca80f47253f8dd523a29489c0fd30162 /src/resources/iteminfo.cpp | |
parent | 582428edf9e40db0d1ed7b78222562a7a5031fe4 (diff) | |
download | manaplus-22f79fd0d623c8e11994905534f53da267e22935.tar.gz manaplus-22f79fd0d623c8e11994905534f53da267e22935.tar.bz2 manaplus-22f79fd0d623c8e11994905534f53da267e22935.tar.xz manaplus-22f79fd0d623c8e11994905534f53da267e22935.zip |
Dehardcode item colors. Now reading all from configs.
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r-- | src/resources/iteminfo.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 49aadc23d..990c78f45 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -82,30 +82,28 @@ std::map<int, int> &ItemInfo::addReplaceSprite(int sprite) return it->second; } -std::string ItemInfo::getDyeString(int color) const +void ItemInfo::setColorsList(std::string name) { - if (mId == 1172) + if (name.empty()) { - if (color == 1) - return "W:#115511,22aa22,99dd99;R:#547000,a5dc00,d1ff46"; - if (color == 0) - return "W:#547000,a5dc00,d1ff46;R:#115511,22aa22,99dd99"; - if (color == 3) - return "W:#ffffff,000000,000000;R:#333333,333333,333333"; + mColors = 0; + mColorList = ""; + } + else + { + mColors = ColorDB::getColorsList(name); + mColorList = name; } - return ""; } std::string ItemInfo::getDyeColorsString(int color) const { - if (mId == 1172) - { - if (color == 1) - return "#115511,22aa22,99dd99;#547000,a5dc00,d1ff46"; - if (color == 0) - return "#547000,a5dc00,d1ff46;#115511,22aa22,99dd99"; - if (color == 3) - return "#ffffff,000000,000000;#333333,333333,333333"; - } - return ""; + if (!mColors || mColorList.empty()) + return ""; + + std::map <int, ColorDB::ItemColor>::iterator it = mColors->find(color); + if (it == mColors->end()) + return ""; + + return it->second.color; }
\ No newline at end of file |