summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-05-05 15:51:17 -0600
committerJared Adams <jaxad0127@gmail.com>2009-05-05 15:52:12 -0600
commit45296672d98ca04cd2e659d5a733bff906342d80 (patch)
tree6d70eef8d4cdeb8aaf283cd204e2e8aa09874f37
parent3c4661726f9321e91037291fcf628a54b993c4ec (diff)
downloadmana-45296672d98ca04cd2e659d5a733bff906342d80.tar.gz
mana-45296672d98ca04cd2e659d5a733bff906342d80.tar.bz2
mana-45296672d98ca04cd2e659d5a733bff906342d80.tar.xz
mana-45296672d98ca04cd2e659d5a733bff906342d80.zip
Fix selling stacked items
-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 +=