diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-08-12 21:47:59 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-08-12 22:01:57 -0600 |
commit | eb2c0cae1cb7a02b72c15de0f4e8f4a68a9fa53a (patch) | |
tree | 8b1fab9acbd0eb568d7f7e0b31f8fd4ac02b18a4 /src/gui/npcdialog.cpp | |
parent | 2293b1c5ef0bb7378140bf73f1fef03a4504bdd2 (diff) | |
download | mana-eb2c0cae1cb7a02b72c15de0f4e8f4a68a9fa53a.tar.gz mana-eb2c0cae1cb7a02b72c15de0f4e8f4a68a9fa53a.tar.bz2 mana-eb2c0cae1cb7a02b72c15de0f4e8f4a68a9fa53a.tar.xz mana-eb2c0cae1cb7a02b72c15de0f4e8f4a68a9fa53a.zip |
Simplify working with the event system
EventManager has been merged into Event, with some new convinience methods
added.
Reviewed-by: Chuck Miller
Diffstat (limited to 'src/gui/npcdialog.cpp')
-rw-r--r-- | src/gui/npcdialog.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index a14e88eb..935962a0 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -22,7 +22,7 @@ #include "gui/npcdialog.h" #include "configuration.h" -#include "eventmanager.h" +#include "event.h" #include "listener.h" #include "playerinfo.h" @@ -50,10 +50,6 @@ #define NpcEvent(name) Mana::Event event(name);\ event.setInt("npcId", mNpcId); -#define FireEvent(event) Mana::EventManager::trigger("NPC", event); - -#define FireEvent2(name) NpcEvent(name) FireEvent(event) - typedef std::map<int, NpcDialog*> NpcDialogs; class NpcEventListener : public Mana::Listener @@ -231,7 +227,7 @@ void NpcDialog::action(const gcn::ActionEvent &event) NpcEvent("doMenu") event.setInt("choice", selectedIndex + 1); - FireEvent(event); + event.trigger("NPC"); } else if (mInputState == NPC_INPUT_STRING) { @@ -239,7 +235,7 @@ void NpcDialog::action(const gcn::ActionEvent &event) NpcEvent("doStringInput") event.setString("value", printText); - FireEvent(event); + event.trigger("NPC"); } else if (mInputState == NPC_INPUT_INTEGER) { @@ -247,7 +243,7 @@ void NpcDialog::action(const gcn::ActionEvent &event) NpcEvent("doIntegerInput") event.setInt("value", mIntField->getValue()); - FireEvent(event); + event.trigger("NPC"); } // addText will auto remove the input layout addText(strprintf("\n> \"%s\"\n", printText.c_str()), false); @@ -285,12 +281,14 @@ void NpcDialog::action(const gcn::ActionEvent &event) void NpcDialog::nextDialog() { - FireEvent2("doNext") + NpcEvent("doNext"); + event.trigger("NPC"); } void NpcDialog::closeDialog() { - FireEvent2("doClose") + NpcEvent("doClose"); + event.trigger("NPC"); close(); } @@ -561,7 +559,8 @@ void NpcEventListener::event(const std::string &channel, if (!dialog) { int mNpcId = id; - FireEvent2("doNext") + NpcEvent("doNext"); + event.trigger("NPC"); return; } @@ -575,7 +574,8 @@ void NpcEventListener::event(const std::string &channel, if (!dialog) { int mNpcId = id; - FireEvent2("doClose") + NpcEvent("doClose"); + event.trigger("NPC"); return; } |