diff options
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r-- | src/resources/iteminfo.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index fb4b8ed5e..5b07724a1 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -108,7 +108,7 @@ const std::string &ItemInfo::getSprite(Gender gender) const } else { - static const std::string empty = ""; + static const std::string empty(""); std::map<int, std::string>::const_iterator i = mAnimationFiles.find(gender); @@ -139,7 +139,7 @@ const std::string &ItemInfo::getSound(EquipmentSoundEvent event) const if (i == mSounds.end()) return empty; - return i->second.size() > 0 ? i->second[rand() % i->second.size()] : empty; + return (!i->second.empty()) ? i->second[rand() % i->second.size()] : empty; } std::map<int, int> *ItemInfo::addReplaceSprite(int sprite, int direction) @@ -185,7 +185,8 @@ std::string ItemInfo::getDyeColorsString(int color) const if (!mColors || mColorList.empty()) return ""; - std::map <int, ColorDB::ItemColor>::iterator it = mColors->find(color); + std::map <int, ColorDB::ItemColor>::const_iterator + it = mColors->find(color); if (it == mColors->end()) return ""; @@ -208,7 +209,8 @@ const std::string ItemInfo::replaceColors(std::string str, std::string name; if (mColors && !mColorList.empty()) { - std::map <int, ColorDB::ItemColor>::iterator it = mColors->find(color); + std::map <int, ColorDB::ItemColor>::const_iterator + it = mColors->find(color); if (it == mColors->end()) name = "unknown"; else @@ -220,7 +222,7 @@ const std::string ItemInfo::replaceColors(std::string str, } str = replaceAll(str, "%color%", name); - if (name.size() > 0) + if (!name.empty()) name[0] = static_cast<char>(toupper(name[0])); return replaceAll(str, "%Color%", name); |