diff options
author | Yohann Ferreira <bertram@cegetel.net> | 2006-11-05 02:22:20 +0000 |
---|---|---|
committer | Yohann Ferreira <bertram@cegetel.net> | 2006-11-05 02:22:20 +0000 |
commit | 88c3ad6046582865fdc32df65aa5603b1048eba1 (patch) | |
tree | 4c16f509559d59140561a91823c039b5798d20f9 | |
parent | 9e70df3a6ac53f9900f7e4cbf6dbe40e53e0ddc1 (diff) | |
download | mana-client-88c3ad6046582865fdc32df65aa5603b1048eba1.tar.gz mana-client-88c3ad6046582865fdc32df65aa5603b1048eba1.tar.bz2 mana-client-88c3ad6046582865fdc32df65aa5603b1048eba1.tar.xz mana-client-88c3ad6046582865fdc32df65aa5603b1048eba1.zip |
Fixes to Sell dialog.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/gui/sell.cpp | 10 | ||||
-rw-r--r-- | src/gui/shop.cpp | 4 | ||||
-rw-r--r-- | src/gui/shop.h | 2 |
4 files changed, 12 insertions, 6 deletions
@@ -9,6 +9,8 @@ src/net/buysellhandler.cpp, src/gui/shoplistbox.h, src/gui/shoplistbox.cpp: Added item's pictures in sell dialogs, and precisions about the total money in it. + * src/gui/shop.h, src/gui/shop.cpp, src/gui/sell.cpp: Fixes to Sell + dialog. 2006-11-05 Björn Steinbrink <B.Steinbrink@gmx.de> 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; diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index d15e7367..3f30732a 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -68,7 +68,7 @@ void ShopItems::clear() mItemsShop.clear(); } -std::vector<ITEM_SHOP> ShopItems::getShop() +std::vector<ITEM_SHOP>* ShopItems::getShop() { - return mItemsShop; + return &mItemsShop; } diff --git a/src/gui/shop.h b/src/gui/shop.h index 006c0146..de452b5c 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -80,7 +80,7 @@ class ShopItems : public gcn::ListModel /** * Direct access to the vector */ - std::vector<ITEM_SHOP> getShop(); + std::vector<ITEM_SHOP>* getShop(); private: std::vector<ITEM_SHOP> mItemsShop; |