From 23ca69dbf704cd289d58f023689289fcab515464 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 22 Sep 2014 14:41:32 +0300 Subject: Simplify SellDialog. --- src/gui/windows/npcselldialog.cpp | 3 ++- src/gui/windows/npcselldialog.h | 2 ++ src/gui/windows/selldialog.cpp | 23 +---------------------- src/gui/windows/selldialog.h | 7 +------ src/gui/windows/shopselldialog.cpp | 3 ++- src/gui/windows/shopselldialog.h | 2 ++ 6 files changed, 10 insertions(+), 30 deletions(-) (limited to 'src/gui') diff --git a/src/gui/windows/npcselldialog.cpp b/src/gui/windows/npcselldialog.cpp index b975bb6d1..a50c31e29 100644 --- a/src/gui/windows/npcselldialog.cpp +++ b/src/gui/windows/npcselldialog.cpp @@ -54,7 +54,8 @@ #include "debug.h" NpcSellDialog::NpcSellDialog(const int npcId) : - SellDialog(npcId) + SellDialog(), + mNpcId(npcId) { } diff --git a/src/gui/windows/npcselldialog.h b/src/gui/windows/npcselldialog.h index a79220a85..02df1e143 100644 --- a/src/gui/windows/npcselldialog.h +++ b/src/gui/windows/npcselldialog.h @@ -44,6 +44,8 @@ class NpcSellDialog final : public SellDialog protected: void sellAction(const ActionEvent &event) override final; + + int mNpcId; }; #endif // GUI_WINDOWS_NPCSELLDIALOG_H diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp index 32ee2e827..4d4c4d8df 100644 --- a/src/gui/windows/selldialog.cpp +++ b/src/gui/windows/selldialog.cpp @@ -55,35 +55,14 @@ SellDialog::DialogList SellDialog::instances; -SellDialog::SellDialog(const int npcId) : +SellDialog::SellDialog() : // TRANSLATORS: sell dialog name Window(_("Sell"), false, nullptr, "sell.xml"), ActionListener(), SelectionListener(), - mNick(""), - mNpcId(npcId), mPlayerMoney(0), mMaxItems(0), mAmountItems(0) -{ - init(); -} - -SellDialog::SellDialog(const std::string &nick) : - // TRANSLATORS: sell dialog name - Window(_("Sell"), false, nullptr, "sell.xml"), - ActionListener(), - SelectionListener(), - mNick(nick), - mNpcId(-1), - mPlayerMoney(0), - mMaxItems(0), - mAmountItems(0) -{ - init(); -} - -void SellDialog::init() { setWindowName("Sell"); setResizable(true); diff --git a/src/gui/windows/selldialog.h b/src/gui/windows/selldialog.h index 471ae74f2..b97cb13dc 100644 --- a/src/gui/windows/selldialog.h +++ b/src/gui/windows/selldialog.h @@ -51,7 +51,7 @@ class SellDialog notfinal : public Window, * * @see Window::Window */ - explicit SellDialog(const int npcId); + SellDialog(); /** * Constructor. @@ -65,8 +65,6 @@ class SellDialog notfinal : public Window, */ ~SellDialog(); - void init(); - /** * Resets the dialog, clearing inventory. */ @@ -124,8 +122,6 @@ class SellDialog notfinal : public Window, virtual void sellAction(const ActionEvent &event) = 0; - std::string mNick; - Button *mSellButton; Button *mQuitButton; Button *mAddMaxButton; @@ -138,7 +134,6 @@ class SellDialog notfinal : public Window, Slider *mSlider; ShopItems *mShopItems; - int mNpcId; int mPlayerMoney; int mMaxItems; int mAmountItems; diff --git a/src/gui/windows/shopselldialog.cpp b/src/gui/windows/shopselldialog.cpp index 71775e726..44b15fd42 100644 --- a/src/gui/windows/shopselldialog.cpp +++ b/src/gui/windows/shopselldialog.cpp @@ -54,7 +54,8 @@ #include "debug.h" ShopSellDialog::ShopSellDialog(const std::string &nick) : - SellDialog(nick) + SellDialog(), + mNick(nick) { } diff --git a/src/gui/windows/shopselldialog.h b/src/gui/windows/shopselldialog.h index bec840409..8ae90d903 100644 --- a/src/gui/windows/shopselldialog.h +++ b/src/gui/windows/shopselldialog.h @@ -44,6 +44,8 @@ class ShopSellDialog final : public SellDialog protected: void sellAction(const ActionEvent &event) override final; + + std::string mNick; }; #endif // GUI_WINDOWS_SHOPSELLDIALOG_H -- cgit v1.2.3-70-g09d2