From 8bc425ff48b7a874ca0fb9d2285044c75f3010ab Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sat, 13 Feb 2010 15:04:58 -0700 Subject: 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. --- src/gui/buy.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/gui/buy.h') diff --git a/src/gui/buy.h b/src/gui/buy.h index 68854a82..d44d63d2 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -47,7 +47,7 @@ class BuyDialog : public Window, public gcn::ActionListener, * * @see Window::Window */ - BuyDialog(); + BuyDialog(int npcId); /** * Destructor @@ -95,21 +95,26 @@ class BuyDialog : public Window, public gcn::ActionListener, void updateButtonsAndLabels(); /** - * 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 DialogList; + static DialogList instances; + + int mNpcId; + gcn::Button *mBuyButton; gcn::Button *mQuitButton; gcn::Button *mAddMaxButton; @@ -128,6 +133,4 @@ class BuyDialog : public Window, public gcn::ActionListener, int mMaxItems; }; -extern BuyDialog *buyDialog; - #endif -- cgit v1.2.3-70-g09d2