From 45296672d98ca04cd2e659d5a733bff906342d80 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 5 May 2009 15:51:17 -0600 Subject: Fix selling stacked items --- src/gui/sell.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gui/sell.cpp') diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index c9b9d649..28288ef4 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -182,16 +182,17 @@ void SellDialog::action(const gcn::ActionEvent &event) { // Attempt sell ShopItem *item = mShopItems->at(selectedItem); - int sellCount; + int sellCount, itemIndex; mPlayerMoney += mAmountItems * mShopItems->at(selectedItem)->getPrice(); mMaxItems -= mAmountItems; while (mAmountItems > 0) { // This order is important, item->getCurrentInvIndex() would return // the inventory index of the next Duplicate otherwise. + itemIndex = item->getCurrentInvIndex(); sellCount = item->sellCurrentDuplicate(mAmountItems); + Net::getNpcHandler()->sellItem(current_npc, itemIndex, sellCount); mAmountItems -= sellCount; - Net::getNpcHandler()->sellItem(current_npc, item->getCurrentInvIndex(), sellCount); } mPlayerMoney += -- cgit v1.2.3-70-g09d2