diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-15 13:58:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-16 01:52:14 +0300 |
commit | 41cc92f73e39cec5dfea6b1164176610cccc7df4 (patch) | |
tree | 22fd3d388084d2c61fe80f0441c3c30ab8ffd33c /src/resources/iteminfo.cpp | |
parent | 7aa637abc8b0bca35aacdb9492e65f557ed32038 (diff) | |
download | plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.gz plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.bz2 plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.xz plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.zip |
Add strong typed int for item color.
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r-- | src/resources/iteminfo.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 768825f44..c439be5c5 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -201,12 +201,12 @@ void ItemInfo::setColorsList(const std::string &name) } } -std::string ItemInfo::getDyeColorsString(const int color) const +std::string ItemInfo::getDyeColorsString(const ItemColor color) const { if (!mColors || mColorList.empty()) return ""; - const std::map <int, ColorDB::ItemColor>::const_iterator + const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator it = mColors->find(color); if (it == mColors->end()) return ""; @@ -214,23 +214,23 @@ std::string ItemInfo::getDyeColorsString(const int color) const return it->second.color; } -const std::string ItemInfo::getDescription(const unsigned char color) const +const std::string ItemInfo::getDescription(const ItemColor color) const { return replaceColors(mDescription, color); } -const std::string ItemInfo::getName(const unsigned char color) const +const std::string ItemInfo::getName(const ItemColor color) const { return replaceColors(mName, color); } const std::string ItemInfo::replaceColors(std::string str, - const unsigned char color) const + const ItemColor color) const { std::string name; if (mColors && !mColorList.empty()) { - const std::map <int, ColorDB::ItemColor>::const_iterator + const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator it = mColors->find(color); if (it == mColors->end()) name = "unknown"; @@ -369,24 +369,24 @@ void ItemInfo::setSprite(const std::string &animationFile, mAnimationFiles[static_cast<int>(gender) + race * 4] = animationFile; } -std::string ItemInfo::getColorName(const int idx) const +std::string ItemInfo::getColorName(const ItemColor idx) const { if (!mColors) return std::string(); - const std::map <int, ColorDB::ItemColor>::const_iterator + const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator it = mColors->find(idx); if (it == mColors->end()) return std::string(); return it->second.name; } -std::string ItemInfo::getColor(const int idx) const +std::string ItemInfo::getColor(const ItemColor idx) const { if (!mColors) return std::string(); - const std::map <int, ColorDB::ItemColor>::const_iterator + const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator it = mColors->find(idx); if (it == mColors->end()) return std::string(); |