From 7c79aa2b8e484319e3e511fa21db6d2448347024 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 27 Aug 2012 21:18:46 +0300 Subject: Add const to more classes. --- src/gui/itempopup.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/gui/itempopup.cpp') 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(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) { -- cgit v1.2.3-70-g09d2