From cf9b1182f06b1336f0d1071c267ea36c990430fa Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Mar 2014 12:07:38 +0300 Subject: Add missing consts into item. --- src/item.cpp | 9 +++++---- src/item.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/item.cpp b/src/item.cpp index fe2fcaa92..02c5d0c16 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -92,11 +92,12 @@ void Item::setId(const int id, const unsigned char color) } } -bool Item::isHaveTag(const int tagId) +bool Item::isHaveTag(const int tagId) const { - if (mTags.find(tagId) == mTags.end()) + const std::map ::const_iterator it = mTags.find(tagId); + if (it == mTags.end()) return false; - return mTags[tagId] > 0; + return (*it).second > 0; } Image *Item::getImage(const int id, const unsigned char color) @@ -112,7 +113,7 @@ Image *Item::getImage(const int id, const unsigned char color) return image; } -std::string Item::getName() +std::string Item::getName() const { const ItemInfo &info = ItemDB::get(mId); if (serverVersion > 0) diff --git a/src/item.h b/src/item.h index adb6ec03e..dc4600d8b 100644 --- a/src/item.h +++ b/src/item.h @@ -153,12 +153,12 @@ class Item const ItemInfo &getInfo() const A_WARN_UNUSED { return ItemDB::get(mId); } - std::string getName() A_WARN_UNUSED; + std::string getName() const A_WARN_UNUSED; static Image *getImage(const int id, const unsigned char color) A_WARN_UNUSED; - bool isHaveTag(const int tagId) A_WARN_UNUSED; + bool isHaveTag(const int tagId) const A_WARN_UNUSED; unsigned char getColor() const A_WARN_UNUSED { return mColor; } -- cgit v1.2.3-70-g09d2