summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-14 21:06:46 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-14 21:06:46 +0300
commit21eb6aa0cc168de4e90b74e4d917df5abd81d9bb (patch)
treebf4717822eb609378db12f18deea980797077b22
parent308f903d2de25ddd99b70e9d8c8ae28f05f3694d (diff)
downloadplus-21eb6aa0cc168de4e90b74e4d917df5abd81d9bb.tar.gz
plus-21eb6aa0cc168de4e90b74e4d917df5abd81d9bb.tar.bz2
plus-21eb6aa0cc168de4e90b74e4d917df5abd81d9bb.tar.xz
plus-21eb6aa0cc168de4e90b74e4d917df5abd81d9bb.zip
Use CREATEWIDGET macro in buysellhandler.
-rw-r--r--src/net/ea/buysellhandler.cpp8
-rw-r--r--src/net/eathena/buysellhandler.cpp5
-rw-r--r--src/net/tmwa/buysellhandler.cpp5
3 files changed, 10 insertions, 8 deletions
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp
index 20d34bc9f..fab83e9a0 100644
--- a/src/net/ea/buysellhandler.cpp
+++ b/src/net/ea/buysellhandler.cpp
@@ -31,6 +31,8 @@
#include "gui/windows/buyselldialog.h"
#include "gui/windows/npcselldialog.h"
+#include "gui/widgets/createwidget.h"
+
#include "net/ea/eaprotocol.h"
#include "resources/notifytypes.h"
@@ -54,8 +56,7 @@ void BuySellHandler::processNpcBuySellChoice(Net::MessageIn &msg)
if (!BuySellDialog::isActive())
{
mNpcId = msg.readBeingId("npc id");
- BuySellDialog *const dialog = new BuySellDialog(mNpcId);
- dialog->postInit();
+ CREATEWIDGET(BuySellDialog, mNpcId);
}
}
@@ -65,8 +66,7 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg)
const int n_items = (msg.getLength() - 4) / 10;
if (n_items > 0)
{
- SellDialog *const dialog = new NpcSellDialog(mNpcId);
- dialog->postInit();
+ SellDialog *const dialog = CREATEWIDGETR(NpcSellDialog, mNpcId);
dialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
for (int k = 0; k < n_items; k++)
diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp
index c10978b3d..00895f7d9 100644
--- a/src/net/eathena/buysellhandler.cpp
+++ b/src/net/eathena/buysellhandler.cpp
@@ -28,6 +28,8 @@
#include "gui/windows/buydialog.h"
+#include "gui/widgets/createwidget.h"
+
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
@@ -92,8 +94,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
msg.readInt16("len");
const int sz = 11;
const int n_items = (msg.getLength() - 4) / sz;
- mBuyDialog = new BuyDialog(mNpcId);
- mBuyDialog->postInit();
+ CREATEWIDGETV(mBuyDialog, BuyDialog, mNpcId);
mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
for (int k = 0; k < n_items; k++)
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index 7ee35c689..a85da12b2 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -31,6 +31,8 @@
#include "gui/windows/chatwindow.h"
#include "gui/windows/shopwindow.h"
+#include "gui/widgets/createwidget.h"
+
#include "net/chathandler.h"
#include "net/serverfeatures.h"
@@ -103,8 +105,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
if (serverFeatures->haveItemColors())
sz += 1;
const unsigned int n_items = (msg.getLength() - 4U) / sz;
- mBuyDialog = new BuyDialog(mNpcId);
- mBuyDialog->postInit();
+ CREATEWIDGETV(mBuyDialog, BuyDialog, mNpcId);
mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
for (unsigned int k = 0; k < n_items; k++)