diff options
author | Chuck Miller <shadowmil@gmail.com> | 2010-11-11 21:55:25 -0500 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2010-11-11 22:45:58 -0500 |
commit | 5727a2d9eeb0688a16e5b7fe32f6d9836c4f7a4e (patch) | |
tree | 994cdeb1187a94996ca38c5e274aabaa5f1fec76 /src/net/manaserv/npchandler.cpp | |
parent | 3dd1baab3fb00a3aa99447430f16a431a205c614 (diff) | |
download | mana-5727a2d9eeb0688a16e5b7fe32f6d9836c4f7a4e.tar.gz mana-5727a2d9eeb0688a16e5b7fe32f6d9836c4f7a4e.tar.bz2 mana-5727a2d9eeb0688a16e5b7fe32f6d9836c4f7a4e.tar.xz mana-5727a2d9eeb0688a16e5b7fe32f6d9836c4f7a4e.zip |
Have the event system channels use enums instead of strings
Reviewed-by: Freeyorp
Diffstat (limited to 'src/net/manaserv/npchandler.cpp')
-rw-r--r-- | src/net/manaserv/npchandler.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp index f7e04c1b..64162cc5 100644 --- a/src/net/manaserv/npchandler.cpp +++ b/src/net/manaserv/npchandler.cpp @@ -52,7 +52,7 @@ NpcHandler::NpcHandler() handledMessages = _messages; npcHandler = this; - listen("NPC"); + listen(CHANNEL_NPC); } void NpcHandler::handleMessage(Net::MessageIn &msg) @@ -77,7 +77,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) event->setString("choice" + toString(count), msg.readString()); } event->setInt("choiceCount", count); - event->trigger("NPC"); + event->trigger(CHANNEL_NPC); break; case GPMSG_NPC_NUMBER: @@ -86,52 +86,52 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) event->setInt("min", msg.readInt32()); event->setInt("max", msg.readInt32()); event->setInt("default", msg.readInt32()); - event->trigger("NPC"); + event->trigger(CHANNEL_NPC); break; case GPMSG_NPC_STRING: event = new Mana::Event("StringInput"); event->setInt("id", npcId); - event->trigger("NPC"); + event->trigger(CHANNEL_NPC); break; case GPMSG_NPC_POST: event = new Mana::Event("Post"); event->setInt("id", npcId); - event->trigger("NPC"); + event->trigger(CHANNEL_NPC); break; case GPMSG_NPC_ERROR: event = new Mana::Event("End"); event->setInt("id", npcId); - event->trigger("NPC"); + event->trigger(CHANNEL_NPC); break; case GPMSG_NPC_MESSAGE: event = new Mana::Event("Message"); event->setInt("id", npcId); event->setString("text", msg.readString(msg.getUnreadLength())); - event->trigger("NPC"); + event->trigger(CHANNEL_NPC); delete event; event = new Mana::Event("Next"); event->setInt("id", npcId); - event->trigger("NPC"); + event->trigger(CHANNEL_NPC); break; case GPMSG_NPC_CLOSE: event = new Mana::Event("Close"); event->setInt("id", npcId); - event->trigger("NPC"); + event->trigger(CHANNEL_NPC); break; } delete event; } -void NpcHandler::event(const std::string &channel, const Mana::Event &event) +void NpcHandler::event(Channels channel, const Mana::Event &event) { - if (channel == "NPC") + if (channel == CHANNEL_NPC) { if (event.getName() == "doTalk") { |