summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-22 14:41:32 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-22 14:41:32 +0300
commit23ca69dbf704cd289d58f023689289fcab515464 (patch)
tree15bc9d2b2b16746689b15bca181f9048320173b9 /src/gui
parentbeaddb973febb0570a9d035c2221e4fd06e3ac47 (diff)
downloadplus-23ca69dbf704cd289d58f023689289fcab515464.tar.gz
plus-23ca69dbf704cd289d58f023689289fcab515464.tar.bz2
plus-23ca69dbf704cd289d58f023689289fcab515464.tar.xz
plus-23ca69dbf704cd289d58f023689289fcab515464.zip
Simplify SellDialog.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/windows/npcselldialog.cpp3
-rw-r--r--src/gui/windows/npcselldialog.h2
-rw-r--r--src/gui/windows/selldialog.cpp23
-rw-r--r--src/gui/windows/selldialog.h7
-rw-r--r--src/gui/windows/shopselldialog.cpp3
-rw-r--r--src/gui/windows/shopselldialog.h2
6 files changed, 10 insertions, 30 deletions
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,36 +55,15 @@
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);
setCloseButton(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