summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-02-23 13:19:31 -0700
committerJared Adams <jaxad0127@gmail.com>2009-02-23 13:19:31 -0700
commitc54b987a4e4d28d35e8bafb03e1dba33b5fda4ab (patch)
treec3a69432b48708d351a02a7232acddee6a8ca6f5 /src
parente01a1776f20a499003ae976e4b145a9c85f6a014 (diff)
downloadmana-client-c54b987a4e4d28d35e8bafb03e1dba33b5fda4ab.tar.gz
mana-client-c54b987a4e4d28d35e8bafb03e1dba33b5fda4ab.tar.bz2
mana-client-c54b987a4e4d28d35e8bafb03e1dba33b5fda4ab.tar.xz
mana-client-c54b987a4e4d28d35e8bafb03e1dba33b5fda4ab.zip
Hide the buy/sell dialogs when there is no NPC
Diffstat (limited to 'src')
-rw-r--r--src/gui/buy.cpp7
-rw-r--r--src/gui/buy.h5
-rw-r--r--src/gui/buysell.cpp7
-rw-r--r--src/gui/buysell.h5
-rw-r--r--src/gui/sell.cpp7
-rw-r--r--src/gui/sell.h5
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.