summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-22 14:14:26 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-22 14:14:26 +0300
commitc860fb83abb48b98f98e20fc19ac1591d03b61d1 (patch)
tree6da6ce13302fe00f061ce54a1eabcb694ee37ecd /src/gui
parentb3f39e67e4bf45f526a6a1867e72e2b35092528b (diff)
downloadmv-c860fb83abb48b98f98e20fc19ac1591d03b61d1.tar.gz
mv-c860fb83abb48b98f98e20fc19ac1591d03b61d1.tar.bz2
mv-c860fb83abb48b98f98e20fc19ac1591d03b61d1.tar.xz
mv-c860fb83abb48b98f98e20fc19ac1591d03b61d1.zip
Add support for show and buy from market.
Diffstat (limited to 'src/gui')
-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