From 77efbb50066a030d1f44f8de8d06ace9f284e3a2 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 3 Sep 2006 15:00:47 +0000 Subject: 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. --- src/gui/buy.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gui/buy.cpp') 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()); } } -- cgit v1.2.3-70-g09d2