diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-09-12 08:15:45 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-09-12 08:15:45 +0000 |
commit | 1afcf2608c0a466d2df21faea1530955cc8061fc (patch) | |
tree | 27f279ca5d012ddd3f805d531e093a2561c15abe | |
parent | e5038965dbea0dbc7269c4114cbdaddd6899c665 (diff) | |
download | mana-1afcf2608c0a466d2df21faea1530955cc8061fc.tar.gz mana-1afcf2608c0a466d2df21faea1530955cc8061fc.tar.bz2 mana-1afcf2608c0a466d2df21faea1530955cc8061fc.tar.xz mana-1afcf2608c0a466d2df21faea1530955cc8061fc.zip |
Allowed selection of items that cannot be afforded, so that their descriptions
are still accessible. Also made sure the player's money value of ShopItemList
gets updated.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/gui/buy.cpp | 16 | ||||
-rw-r--r-- | src/gui/buy.h | 2 | ||||
-rw-r--r-- | src/gui/shoplistbox.cpp | 20 |
4 files changed, 14 insertions, 28 deletions
@@ -2,6 +2,10 @@ * data/items.xml, data/equipment.xml: Added temporary weapon IDs below 256 to use as view-ID in eAthena's item DB. + * src/gui/shoplistbox.cpp, src/gui/buy.h, src/gui/buy.cpp: Allowed + selection of items that cannot be afforded, so that their descriptions + are still accessible. Also made sure the player's money value of + ShopItemList gets updated. 2007-09-11 Eugenio Favalli <elvenprogrammer@gmail.com> diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 3c7cbd51..3516129b 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -28,6 +28,7 @@ #include "button.h" #include "scrollarea.h" #include "shop.h" +#include "shoplistbox.h" #include "slider.h" #include "../npc.h" @@ -111,13 +112,12 @@ void BuyDialog::reset() { mShopItems->clear(); mShopItemList->adjustSize(); - mMoney = 0; - mSlider->setValue(0); - // Reset Previous Selected Items to prevent failing asserts + // Reset previous selected items to prevent failing asserts mShopItemList->setSelected(-1); + mSlider->setValue(0); - updateButtonsAndLabels(); + setMoney(0); } void BuyDialog::addItem(short id, int price) @@ -173,16 +173,14 @@ void BuyDialog::action(const gcn::ActionEvent &event) outMsg.writeInt16(mAmountItems); outMsg.writeInt16(mShopItems->at(selectedItem).id); - // Update money and adjust the max number of items that can be bought - mMoney -= mAmountItems * mShopItems->at(selectedItem).price; - mMaxItems -= mAmountItems; - // Reset selection mAmountItems = 1; mSlider->setValue(1); mSlider->gcn::Slider::setScale(1, mMaxItems); - updateButtonsAndLabels(); + // Update money and adjust the max number of items that can be bought + mMaxItems -= mAmountItems; + setMoney(mMoney - mAmountItems * mShopItems->at(selectedItem).price); } } diff --git a/src/gui/buy.h b/src/gui/buy.h index d8016216..5ee7ab95 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -28,12 +28,12 @@ #include "window.h" #include "selectionlistener.h" -#include "shoplistbox.h" #include "../guichanfwd.h" class Network; class ShopItems; +class ShopListBox; class ListBox; /** diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index 946f518b..4efd6e64 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -129,24 +129,8 @@ void ShopListBox::mousePressed(gcn::MouseEvent &event) { if (event.getButton() == gcn::MouseEvent::LEFT) { - bool enoughMoney = false; - int y = event.getY(); - - if (mShopItems && mPriceCheck) - { - if (mPlayerMoney >= mShopItems->at(y / mRowHeight).price) - enoughMoney = true; - } - else // Old Behaviour - { - enoughMoney = true; - } - - if (enoughMoney) - { - setSelected(y / mRowHeight); - generateAction(); - } + setSelected(event.getY() / mRowHeight); + generateAction(); } } |