summaryrefslogtreecommitdiff
path: root/src/gui/buy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/buy.cpp')
-rw-r--r--src/gui/buy.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index c701499c..a8a1ea7e 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -85,8 +85,8 @@ BuyDialog::BuyDialog(Network *network):
mItemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14));
mItemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14));
- mShopItemList->setEventId("item");
- mSlider->setEventId("slider");
+ mShopItemList->setActionEventId("item");
+ mSlider->setActionEventId("slider");
mShopItemList->addSelectionListener(this);
mSlider->addActionListener(this);
@@ -143,11 +143,11 @@ void BuyDialog::addItem(short id, int price)
mShopItemList->adjustSize();
}
-void BuyDialog::action(const std::string& eventId, gcn::Widget* widget)
+void BuyDialog::action(const gcn::ActionEvent &event)
{
int selectedItem = mShopItemList->getSelected();
- if (eventId == "quit")
+ if (event.getId() == "quit")
{
setVisible(false);
current_npc = 0;
@@ -161,12 +161,12 @@ void BuyDialog::action(const std::string& eventId, gcn::Widget* widget)
bool updateButtonsAndLabels = false;
- if (eventId == "slider")
+ if (event.getId() == "slider")
{
mAmountItems = (int)(mSlider->getValue() * mMaxItems);
updateButtonsAndLabels = true;
}
- else if (eventId == "+")
+ else if (event.getId() == "+")
{
if (mAmountItems < mMaxItems) {
mAmountItems++;
@@ -177,7 +177,7 @@ void BuyDialog::action(const std::string& eventId, gcn::Widget* widget)
mSlider->setValue(double(mAmountItems)/double(mMaxItems));
updateButtonsAndLabels = true;
}
- else if (eventId == "-")
+ else if (event.getId() == "-")
{
if (mAmountItems > 0) {
mAmountItems--;
@@ -191,7 +191,7 @@ void BuyDialog::action(const std::string& eventId, gcn::Widget* widget)
// TODO: Actually we'd have a bug elsewhere if this check for the number
// of items to be bought ever fails, Bertram removed the assertions, is
// there a better way to ensure this fails in an _obivous_ way in C++?
- else if (eventId == "buy" && (mAmountItems > 0 &&
+ else if (event.getId() == "buy" && (mAmountItems > 0 &&
mAmountItems <= mMaxItems))
{
MessageOut outMsg(mNetwork);