summaryrefslogtreecommitdiff
path: root/src/item.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-30 22:53:27 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-30 22:53:27 +0300
commit5cbd0d2cb7086fda592c00dbc3b07d06af95f080 (patch)
treed36b4ac344f31f34311c7cb7a9a637ed48356e3e /src/item.cpp
parent4210163dae7d6266923ab11f78b631173c9533e3 (diff)
downloadmanaplus-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.tar.gz
manaplus-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.tar.bz2
manaplus-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.tar.xz
manaplus-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.zip
Add const to more classes.
Diffstat (limited to 'src/item.cpp')
-rw-r--r--src/item.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/item.cpp b/src/item.cpp
index 1311a7354..0c12020aa 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -33,8 +33,9 @@
extern int serverVersion;
-Item::Item(int id, int quantity, int refine, unsigned char color,
- bool equipment, bool equipped):
+Item::Item(const int id, const int quantity, const int refine,
+ const unsigned char color, const bool equipment,
+ const bool equipped):
mImage(nullptr),
mDrawImage(nullptr),
mQuantity(quantity),
@@ -61,7 +62,7 @@ Item::~Item()
}
}
-void Item::setId(int id, unsigned char color)
+void Item::setId(const int id, const unsigned char color)
{
mId = id;
mColor = color;
@@ -76,7 +77,7 @@ void Item::setId(int id, unsigned char color)
if (mDrawImage)
mDrawImage->decRef();
- ResourceManager *resman = ResourceManager::getInstance();
+ ResourceManager *const resman = ResourceManager::getInstance();
const ItemInfo &info = getInfo();
mTags = info.getTags();
@@ -99,16 +100,16 @@ void Item::setId(int id, unsigned char color)
}
}
-bool Item::isHaveTag(int tagId)
+bool Item::isHaveTag(const int tagId)
{
if (mTags.find(tagId) == mTags.end())
return false;
return mTags[tagId] > 0;
}
-Image *Item::getImage(int id, unsigned char color)
+Image *Item::getImage(const int id, const unsigned char color)
{
- ResourceManager *resman = ResourceManager::getInstance();
+ ResourceManager *const resman = ResourceManager::getInstance();
const ItemInfo &info = ItemDB::get(id);
SpriteDisplay display = info.getDisplay();
std::string imagePath = paths.getStringValue("itemIcons") + display.image;