summaryrefslogtreecommitdiff
path: root/src/gui/sell.h
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-02-13 15:04:58 -0700
committerJared Adams <jaxad0127@gmail.com>2010-02-13 15:08:54 -0700
commit8bc425ff48b7a874ca0fb9d2285044c75f3010ab (patch)
tree5904c7f53cde9ffbe7df2a63f088561141e06b66 /src/gui/sell.h
parent28c9cec5d39c9a1b98694eba9a28281cf111e34a (diff)
downloadmana-8bc425ff48b7a874ca0fb9d2285044c75f3010ab.tar.gz
mana-8bc425ff48b7a874ca0fb9d2285044c75f3010ab.tar.bz2
mana-8bc425ff48b7a874ca0fb9d2285044c75f3010ab.tar.xz
mana-8bc425ff48b7a874ca0fb9d2285044c75f3010ab.zip
Make NPC dialogs instance instead of global
This change allows players to talk to multiple NPCs at a time (if the server agrees). Manaserv's netcode allows multiple commerce instances too. eAthena's is limited to one commerce instance, due to protocol limitations.
Diffstat (limited to 'src/gui/sell.h')
-rw-r--r--src/gui/sell.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/gui/sell.h b/src/gui/sell.h
index c2462762..0c768153 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -46,7 +46,7 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener
*
* @see Window::Window
*/
- SellDialog();
+ SellDialog(int npcId);
/**
* Destructor
@@ -81,25 +81,31 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener
void setMoney(int amount);
/**
- * Check for current NPC
+ * Sets the visibility of this window.
*/
- void logic();
+ void setVisible(bool visible);
/**
- * Sets the visibility of this window.
+ * Returns true if any instances exist.
*/
- void setVisible(bool visible);
+ static bool isActive() { return instances.size() > 0; }
/**
- * Closes the Buy Window, as well as resetting the current npc.
+ * Closes all instances.
*/
- void close();
+ static void closeAll();
+
private:
+ typedef std::list<SellDialog*> DialogList;
+ static DialogList instances;
+
/**
* Updates the state of buttons and labels.
*/
void updateButtonsAndLabels();
+ int mNpcId;
+
gcn::Button *mSellButton;
gcn::Button *mQuitButton;
gcn::Button *mAddMaxButton;
@@ -118,6 +124,4 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener
int mAmountItems;
};
-extern SellDialog *sellDialog;
-
#endif