summaryrefslogtreecommitdiff
path: root/src/gui/buysell.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/buysell.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/buysell.h')
-rw-r--r--src/gui/buysell.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gui/buysell.h b/src/gui/buysell.h
index 0294ad18..33314420 100644
--- a/src/gui/buysell.h
+++ b/src/gui/buysell.h
@@ -40,12 +40,9 @@ class BuySellDialog : public Window, public gcn::ActionListener
*
* @see Window::Window
*/
- BuySellDialog();
+ BuySellDialog(int npcId);
- /**
- * Check for current NPC
- */
- void logic();
+ ~BuySellDialog();
void setVisible(bool visible);
@@ -54,10 +51,22 @@ 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();
+
private:
+ typedef std::list<BuySellDialog*> DialogList;
+ static DialogList instances;
+
+ int mNpcId;
gcn::Button *mBuyButton;
};
-extern BuySellDialog *buySellDialog;
-
#endif