summaryrefslogtreecommitdiff
path: root/src/gui/sell.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-09-03 15:00:47 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-09-03 15:00:47 +0000
commit77efbb50066a030d1f44f8de8d06ace9f284e3a2 (patch)
tree22d737ac0058e4fa87e7767d41e02999bcbf84be /src/gui/sell.cpp
parent40ca3dc75197412594c5f6a78d68b265e235024b (diff)
downloadmana-client-77efbb50066a030d1f44f8de8d06ace9f284e3a2.tar.gz
mana-client-77efbb50066a030d1f44f8de8d06ace9f284e3a2.tar.bz2
mana-client-77efbb50066a030d1f44f8de8d06ace9f284e3a2.tar.xz
mana-client-77efbb50066a030d1f44f8de8d06ace9f284e3a2.zip
Introduced SelectionListener to fix updating problem in inventory window
(should also be used to fix similar problem in trade, buy and sell dialogs). Made the ItemInfo be passed around as a reference instead of a pointer, since it is never NULL.
Diffstat (limited to 'src/gui/sell.cpp')
-rw-r--r--src/gui/sell.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 17185d71..44fa8e41 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -142,7 +142,7 @@ void SellDialog::addItem(Item *item, int price)
ITEM_SHOP item_shop;
- item_shop.name = item->getInfo()->getName() + " " + toString(price) + " GP";
+ item_shop.name = item->getInfo().getName() + " " + toString(price) + " GP";
item_shop.price = price;
item_shop.index = item->getInvIndex();
item_shop.id = item->getId();
@@ -259,9 +259,10 @@ void SellDialog::mouseClick(int x, int y, int button, int count)
int selectedItem = mItemList->getSelected();
if (selectedItem > -1)
{
- mItemDescLabel->setCaption("Description: " +
- itemDb->getItemInfo(mShopItems->at(selectedItem).id)->getDescription());
- mItemEffectLabel->setCaption("Effect: " +
- itemDb->getItemInfo(mShopItems->at(selectedItem).id)->getEffect());
+ const ItemInfo &info =
+ itemDb->getItemInfo(mShopItems->at(selectedItem).id);
+
+ mItemDescLabel->setCaption("Description: " + info.getDescription());
+ mItemEffectLabel->setCaption("Effect: " + info.getEffect());
}
}