summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--src/gui/buy.cpp16
-rw-r--r--src/gui/buy.h2
-rw-r--r--src/gui/shoplistbox.cpp20
4 files changed, 14 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 3bf9046c..cb92d5f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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();
}
}