summaryrefslogtreecommitdiff
path: root/src/gui/sell.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2006-11-05 02:22:20 +0000
committerYohann Ferreira <bertram@cegetel.net>2006-11-05 02:22:20 +0000
commit88c3ad6046582865fdc32df65aa5603b1048eba1 (patch)
tree4c16f509559d59140561a91823c039b5798d20f9 /src/gui/sell.cpp
parent9e70df3a6ac53f9900f7e4cbf6dbe40e53e0ddc1 (diff)
downloadmana-client-88c3ad6046582865fdc32df65aa5603b1048eba1.tar.gz
mana-client-88c3ad6046582865fdc32df65aa5603b1048eba1.tar.bz2
mana-client-88c3ad6046582865fdc32df65aa5603b1048eba1.tar.xz
mana-client-88c3ad6046582865fdc32df65aa5603b1048eba1.zip
Fixes to Sell dialog.
Diffstat (limited to 'src/gui/sell.cpp')
-rw-r--r--src/gui/sell.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 62fc2586..7f50c1e4 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -168,7 +168,6 @@ void SellDialog::action(const std::string& eventId, gcn::Widget* widget)
mDecreaseButton->setEnabled(false);
mSellButton->setEnabled(false);
- mQuantityLabel->setCaption("0");
mQuantityLabel->adjustSize();
mMoneyLabel->setCaption("Money: 0 GP / Total: "
+ toString(mPlayerMoney) + " GP");
@@ -178,10 +177,13 @@ void SellDialog::action(const std::string& eventId, gcn::Widget* widget)
mSlider->setEnabled(true);
mIncreaseButton->setEnabled(true);
mMaxItems = mShopItems->at(selectedItem).quantity;
+ mQuantityLabel->setCaption("0 / " + toString(mMaxItems));
} else {
mSlider->setEnabled(false);
mIncreaseButton->setEnabled(false);
+ mQuantityLabel->setCaption("0");
}
+ mQuantityLabel->adjustSize();
}
else if (eventId == "quit")
{
@@ -231,14 +233,16 @@ void SellDialog::action(const std::string& eventId, gcn::Widget* widget)
outMsg.writeInt16(mAmountItems);
mMaxItems -= mAmountItems;
+ mShopItems->getShop()->at(selectedItem).quantity = mMaxItems;
mAmountItems = 0;
mSlider->setValue(0);
mSlider->setEnabled(mMaxItems != 0);
// All were sold
if (!mMaxItems) {
+
mShopItemList->setSelected(-1);
- mShopItems->getShop().erase(mShopItems->getShop().begin() + selectedItem);
+ mShopItems->getShop()->erase(mShopItems->getShop()->begin() + selectedItem);
}
// Update only when there are items left, the entry doesn't exist
@@ -250,7 +254,7 @@ void SellDialog::action(const std::string& eventId, gcn::Widget* widget)
if (updateButtonsAndLabels)
{
// Update labels
- mQuantityLabel->setCaption(toString(mAmountItems));
+ mQuantityLabel->setCaption(toString(mAmountItems) + " / " + toString(mMaxItems));
mQuantityLabel->adjustSize();
int price = mAmountItems * mShopItems->at(selectedItem).price;