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.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 299633e9..0ef187be 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -21,6 +21,11 @@
#include "gui/buy.h"
+#include "client.h"
+#include "playerinfo.h"
+#include "shopitem.h"
+#include "units.h"
+
#include "gui/setup.h"
#include "gui/widgets/button.h"
@@ -31,10 +36,6 @@
#include "gui/widgets/shoplistbox.h"
#include "gui/widgets/slider.h"
-#include "npc.h"
-#include "shopitem.h"
-#include "units.h"
-
#include "net/net.h"
#include "net/npchandler.h"
@@ -112,6 +113,8 @@ BuyDialog::BuyDialog(int npcId):
instances.push_back(this);
setVisible(true);
+
+ PlayerInfo::setBuySellState(BUYSELL_BUYING);
}
BuyDialog::~BuyDialog()
@@ -119,6 +122,9 @@ BuyDialog::~BuyDialog()
delete mShopItems;
instances.remove(this);
+
+ if (PlayerInfo::getBuySellState() == BUYSELL_BUYING)
+ PlayerInfo::setBuySellState(BUYSELL_NONE);
}
void BuyDialog::setMoney(int amount)
@@ -217,6 +223,15 @@ void BuyDialog::valueChanged(const gcn::SelectionEvent &event)
mSlider->gcn::Slider::setScale(1, mMaxItems);
}
+void BuyDialog::mouseClicked(gcn::MouseEvent &mouseEvent)
+{
+ if (mouseEvent.getSource() == mShopItemList &&
+ isDoubleClick(mShopItemList->getSelected()))
+ {
+ action(gcn::ActionEvent(mBuyButton, mBuyButton->getActionEventId()));
+ }
+}
+
void BuyDialog::updateButtonsAndLabels()
{
const int selectedItem = mShopItemList->getSelected();