summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-27 21:18:46 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-27 21:44:17 +0300
commit7c79aa2b8e484319e3e511fa21db6d2448347024 (patch)
tree3c4fb4e72414dd8c0d93401a6bf2cc86b65a34a0 /src/gui/itempopup.cpp
parentde476bb95242e10c833394ef007728072eabe60f (diff)
downloadmanaplus-7c79aa2b8e484319e3e511fa21db6d2448347024.tar.gz
manaplus-7c79aa2b8e484319e3e511fa21db6d2448347024.tar.bz2
manaplus-7c79aa2b8e484319e3e511fa21db6d2448347024.tar.xz
manaplus-7c79aa2b8e484319e3e511fa21db6d2448347024.zip
Add const to more classes.
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r--src/gui/itempopup.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index fa65c7a42..feb9a050d 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -98,7 +98,7 @@ ItemPopup::~ItemPopup()
}
}
-void ItemPopup::setItem(const Item *item, bool showImage)
+void ItemPopup::setItem(const Item *const item, const bool showImage)
{
if (!item)
return;
@@ -120,14 +120,14 @@ void ItemPopup::setItem(const Item *item, bool showImage)
ii.getName().c_str(), item->getRefine(), ii.getId()));
}
mItemName->adjustSize();
- unsigned minWidth = mItemName->getWidth() + 8;
+ const unsigned minWidth = mItemName->getWidth() + 8;
if (static_cast<unsigned>(getWidth()) < minWidth)
setWidth(minWidth);
}
}
-void ItemPopup::setItem(const ItemInfo &item, unsigned char color,
- bool showImage, int id)
+void ItemPopup::setItem(const ItemInfo &item, const unsigned char color,
+ const bool showImage, int id)
{
if (!mIcon || (item.getName() == mLastName && color == mLastColor))
return;
@@ -137,26 +137,25 @@ void ItemPopup::setItem(const ItemInfo &item, unsigned char color,
int space = 0;
- Image *oldImage = mIcon->getImage();
+ Image *const oldImage = mIcon->getImage();
if (oldImage)
oldImage->decRef();
if (showImage)
{
- ResourceManager *resman = ResourceManager::getInstance();
- logger->log("img: " + combineDye2(
- paths.getStringValue("itemIcons")
- + item.getDisplay().image, item.getDyeColorsString(color)));
- Image *image = resman->getImage(combineDye2(
+ ResourceManager *const resman = ResourceManager::getInstance();
+// logger->log("img: " + combineDye2(
+// paths.getStringValue("itemIcons")
+// + item.getDisplay().image, item.getDyeColorsString(color)));
+ Image *const image = resman->getImage(combineDye2(
paths.getStringValue("itemIcons")
+ item.getDisplay().image, item.getDyeColorsString(color)));
mIcon->setImage(image);
if (image)
{
- int x = getPadding();
- int y = getPadding();
- mIcon->setPosition(x, y);
+ const int pad = getPadding();
+ mIcon->setPosition(pad, pad);
space = mIcon->getWidth();
}
}
@@ -233,7 +232,7 @@ void ItemPopup::setItem(const ItemInfo &item, unsigned char color,
(numRowsDesc + getPadding()) * height);
}
-gcn::Color ItemPopup::getColor(ItemType type)
+gcn::Color ItemPopup::getColor(const ItemType type)
{
switch (type)
{