summaryrefslogtreecommitdiff
path: root/src/gui/windows/buydialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/buydialog.cpp')
-rw-r--r--src/gui/windows/buydialog.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index dbc6dd59b..61b5d7233 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -45,6 +45,7 @@
#include "net/adminhandler.h"
#include "net/buysellhandler.h"
+#include "net/markethandler.h"
#include "net/npchandler.h"
#include "resources/iteminfo.h"
@@ -439,8 +440,19 @@ void BuyDialog::action(const ActionEvent &event)
else if (mNpcId != -1)
{
const ShopItem *const item = mShopItems->at(selectedItem);
- npcHandler->buyItem(mNpcId, item->getId(),
- item->getColor(), mAmountItems);
+ if (mNpcId != -3)
+ {
+ npcHandler->buyItem(mNpcId,
+ item->getId(),
+ item->getColor(),
+ mAmountItems);
+ }
+ else
+ {
+ marketHandler->buyItem(item->getId(),
+ item->getColor(),
+ mAmountItems);
+ }
// Update money and adjust the max number of items
// that can be bought