diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-08-01 21:32:16 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-08-01 21:35:09 -0600 |
commit | a3e61c0e830c46b51c0d135962ad361c02b93243 (patch) | |
tree | 3b94948be5750c8f968ea89723799eb4f119c063 /src/gui | |
parent | 0e189bbe81c88283438aabb4fec3ba30920d3a36 (diff) | |
download | mana-client-a3e61c0e830c46b51c0d135962ad361c02b93243.tar.gz mana-client-a3e61c0e830c46b51c0d135962ad361c02b93243.tar.bz2 mana-client-a3e61c0e830c46b51c0d135962ad361c02b93243.tar.xz mana-client-a3e61c0e830c46b51c0d135962ad361c02b93243.zip |
Remove isActive methods from buy/sell windows
Uses a state variable in PlayerInfo instead. Moves isTalking from Being
to PlayerInfo. Also some small cleanups.
Reviewed-by: Chuck Miller
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/buy.cpp | 6 | ||||
-rw-r--r-- | src/gui/buy.h | 5 | ||||
-rw-r--r-- | src/gui/buysell.cpp | 7 | ||||
-rw-r--r-- | src/gui/buysell.h | 5 | ||||
-rw-r--r-- | src/gui/sell.cpp | 6 | ||||
-rw-r--r-- | src/gui/sell.h | 5 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 3 |
7 files changed, 21 insertions, 16 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index a214c075..cc135e07 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -21,6 +21,7 @@ #include "gui/buy.h" +#include "playerinfo.h" #include "shopitem.h" #include "units.h" @@ -111,6 +112,8 @@ BuyDialog::BuyDialog(int npcId): instances.push_back(this); setVisible(true); + + PlayerInfo::setBuySellState(BUYSELL_BUYING); } BuyDialog::~BuyDialog() @@ -118,6 +121,9 @@ BuyDialog::~BuyDialog() delete mShopItems; instances.remove(this); + + if (PlayerInfo::getBuySellState() == BUYSELL_BUYING) + PlayerInfo::setBuySellState(BUYSELL_NONE); } void BuyDialog::setMoney(int amount) diff --git a/src/gui/buy.h b/src/gui/buy.h index 4b273bcc..c3cb3229 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -100,11 +100,6 @@ class BuyDialog : public Window, public gcn::ActionListener, void setVisible(bool visible); /** - * Returns true if any instances exist. - */ - static bool isActive() { return instances.size() > 0; } - - /** * Closes all instances. */ static void closeAll(); diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index 3e810a4a..4419ffcc 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -21,6 +21,8 @@ #include "buysell.h" +#include "playerinfo.h" + #include "gui/setup.h" #include "gui/widgets/button.h" @@ -65,11 +67,16 @@ BuySellDialog::BuySellDialog(int npcId): instances.push_back(this); setVisible(true); + + PlayerInfo::setBuySellState(BUYSELL_CHOOSING); } BuySellDialog::~BuySellDialog() { instances.remove(this); + + if (PlayerInfo::getBuySellState() == BUYSELL_CHOOSING) + PlayerInfo::setBuySellState(BUYSELL_NONE); } void BuySellDialog::setVisible(bool visible) diff --git a/src/gui/buysell.h b/src/gui/buysell.h index cf7ec91e..3408821a 100644 --- a/src/gui/buysell.h +++ b/src/gui/buysell.h @@ -52,11 +52,6 @@ class BuySellDialog : public Window, public gcn::ActionListener void action(const gcn::ActionEvent &event); /** - * Returns true if any instances exist. - */ - static bool isActive() { return instances.size() > 0; } - - /** * Closes all instances. */ static void closeAll(); diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index b017983c..83f01d7f 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -21,6 +21,7 @@ #include "gui/sell.h" +#include "playerinfo.h" #include "shopitem.h" #include "units.h" @@ -110,6 +111,8 @@ SellDialog::SellDialog(int npcId): instances.push_back(this); setVisible(true); + + PlayerInfo::setBuySellState(BUYSELL_SELLING); } SellDialog::~SellDialog() @@ -117,6 +120,9 @@ SellDialog::~SellDialog() delete mShopItems; instances.remove(this); + + if (PlayerInfo::getBuySellState() == BUYSELL_SELLING) + PlayerInfo::setBuySellState(BUYSELL_NONE); } void SellDialog::reset() diff --git a/src/gui/sell.h b/src/gui/sell.h index 32a4dc55..c286dcc2 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -86,11 +86,6 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener void setVisible(bool visible); /** - * Returns true if any instances exist. - */ - static bool isActive() { return instances.size() > 0; } - - /** * Closes all instances. */ static void closeAll(); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index f1cd38e4..fc9adab1 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -28,6 +28,7 @@ #include "keyboardconfig.h" #include "localplayer.h" #include "map.h" +#include "playerinfo.h" #include "textmanager.h" #include "gui/gui.h" @@ -345,7 +346,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) return; // Check if we are busy - if (Being::isTalking()) + if (PlayerInfo::isTalking()) return; mPlayerFollowMouse = false; |