summaryrefslogtreecommitdiff
path: root/src/gui/buy.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/buy.cpp
parent40ca3dc75197412594c5f6a78d68b265e235024b (diff)
downloadmana-77efbb50066a030d1f44f8de8d06ace9f284e3a2.tar.gz
mana-77efbb50066a030d1f44f8de8d06ace9f284e3a2.tar.bz2
mana-77efbb50066a030d1f44f8de8d06ace9f284e3a2.tar.xz
mana-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/buy.cpp')
-rw-r--r--src/gui/buy.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 7b9eb29c..20ceca92 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -140,7 +140,8 @@ void BuyDialog::addItem(short id, int price)
{
ITEM_SHOP item_shop;
- item_shop.name = itemDb->getItemInfo(id)->getName() + " " + toString(price) + " GP";
+ item_shop.name = itemDb->getItemInfo(id).getName() + " "
+ + toString(price) + " GP";
item_shop.price = price;
item_shop.id = id;
@@ -262,9 +263,10 @@ void BuyDialog::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());
}
}