summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/sell.cpp5
1 files changed, 3 insertions, 2 deletions
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 +=