diff options
-rw-r--r-- | src/gui/buy.cpp | 7 | ||||
-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 | 7 | ||||
-rw-r--r-- | src/gui/sell.h | 5 |
6 files changed, 36 insertions, 0 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index b31d48e1..c084c7c2 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -241,3 +241,10 @@ void BuyDialog::updateButtonsAndLabels() Units::formatCurrency(price).c_str(), Units::formatCurrency(mMoney - price).c_str())); } + +void BuyDialog::logic() +{ + Window::logic(); + + if (!current_npc) setVisible(false); +} diff --git a/src/gui/buy.h b/src/gui/buy.h index 0f1cfede..55a1898c 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -95,6 +95,11 @@ class BuyDialog : public Window, public gcn::ActionListener, */ void updateButtonsAndLabels(); + /** + * Check for current NPC + */ + void logic(); + private: Network *mNetwork; gcn::Button *mBuyButton; diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index 2d39eac7..8bf5f1f4 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -51,6 +51,13 @@ BuySellDialog::BuySellDialog(): requestFocus(); } +void BuySellDialog::logic() +{ + Window::logic(); + + if (!current_npc) setVisible(false); +} + void BuySellDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "Buy") { diff --git a/src/gui/buysell.h b/src/gui/buysell.h index e3cdc52a..754bb551 100644 --- a/src/gui/buysell.h +++ b/src/gui/buysell.h @@ -43,6 +43,11 @@ class BuySellDialog : public Window, public gcn::ActionListener BuySellDialog(); /** + * Check for current NPC + */ + void logic(); + + /** * Called when receiving actions from the widgets. */ void action(const gcn::ActionEvent &event); diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index dad6af21..20a2a786 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -254,3 +254,10 @@ void SellDialog::updateButtonsAndLabels() Units::formatCurrency(income).c_str(), Units::formatCurrency(mPlayerMoney - income).c_str())); } + +void SellDialog::logic() +{ + Window::logic(); + + if (!current_npc) setVisible(false); +} diff --git a/src/gui/sell.h b/src/gui/sell.h index c11a7b7c..3777b91e 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -81,6 +81,11 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener */ void setMoney(int amount); + /** + * Check for current NPC + */ + void logic(); + private: /** * Updates the state of buttons and labels. |