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/sell.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/gui/sell.cpp') 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()); } } -- cgit v1.2.3-70-g09d2