diff options
author | Chuck Miller <shadowmil@gmail.com> | 2010-11-11 23:12:29 -0500 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2010-11-11 23:12:29 -0500 |
commit | a4640305fd0d88c6332112712aa69e496368e01b (patch) | |
tree | 0f039b331026ca2b9718a920b24e2344f9e56b25 /src/net/tmwa | |
parent | 5727a2d9eeb0688a16e5b7fe32f6d9836c4f7a4e (diff) | |
download | mana-client-a4640305fd0d88c6332112712aa69e496368e01b.tar.gz mana-client-a4640305fd0d88c6332112712aa69e496368e01b.tar.bz2 mana-client-a4640305fd0d88c6332112712aa69e496368e01b.tar.xz mana-client-a4640305fd0d88c6332112712aa69e496368e01b.zip |
Replace Event names with enums instead of strings
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 12 | ||||
-rw-r--r-- | src/net/tmwa/gamehandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/tmwa/npchandler.cpp | 24 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/tradehandler.cpp | 2 |
7 files changed, 30 insertions, 30 deletions
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 9529a386..33826762 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -82,7 +82,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) break; case 0x01: { - Mana::Event event("WhisperError"); + Mana::Event event(EVENT_WHISPERERROR); event.setString("nick", nick); event.setString("error", strprintf(_("Whisper could " "not be sent, %s is offline."), nick.c_str())); @@ -91,7 +91,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) break; case 0x02: { - Mana::Event event("WhisperError"); + Mana::Event event(EVENT_WHISPERERROR); event.setString("nick", nick); event.setString("error", strprintf(_("Whisper could " "not be sent, ignored by %s."), nick.c_str())); @@ -115,7 +115,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) { if (player_relations.hasPermission(nick, PlayerRelation::WHISPER)) { - Mana::Event event("Whisper"); + Mana::Event event(EVENT_WHISPER); event.setString("nick", nick); event.setString("message", chatMsg); event.trigger(CHANNEL_CHAT); @@ -174,7 +174,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) std::string reducedMessage = chatMsg; chatMsg = removeColors(sender_name) + " : " + reducedMessage; - Mana::Event event("Being"); + Mana::Event event(EVENT_BEING); event.setString("message", chatMsg); event.setString("text", reducedMessage); event.setString("nick", sender_name); @@ -205,7 +205,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) trim(chatMsg); - Mana::Event event("Player"); + Mana::Event event(EVENT_PLAYER); event.setString("message", mes); event.setString("text", chatMsg); event.setString("nick", player_node->getName()); @@ -217,7 +217,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) } else { - Mana::Event event("Announcement"); + Mana::Event event(EVENT_ANNOUNCEMENT); event.setString("message", chatMsg); event.trigger(CHANNEL_CHAT); } diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index d98daa64..63f5fcec 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -109,11 +109,11 @@ void GameHandler::event(Channels channel, const Mana::Event &event) { if (channel == CHANNEL_GAME) { - if (event.getName() == "EnginesInitalized") + if (event.getName() == EVENT_ENGINESINITALIZED) { Game::instance()->changeMap(mMap); } - else if (event.getName() == "MapLoaded") + else if (event.getName() == EVENT_MAPLOADED) { MessageOut outMsg(CMSG_MAP_LOADED); } diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index f9ed97b0..b4327d47 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -222,7 +222,7 @@ void GeneralHandler::event(Channels channel, { if (channel == CHANNEL_GAME) { - if (event.getName() == "GuiWindowsLoaded") + if (event.getName() == EVENT_GUIWINDOWSLOADED) { inventoryWindow->setSplitAllowed(false); skillDialog->loadSkills("ea-skills.xml"); @@ -242,7 +242,7 @@ void GeneralHandler::event(Channels channel, statusWindow->addAttribute(FLEE, _("% Evade"), false, ""); statusWindow->addAttribute(CRIT, _("% Critical"), false, ""); } - else if (event.getName() == "GuiWindowsUnloading") + else if (event.getName() == EVENT_GUIWINDOWSUNLOADING) { socialWindow->removeTab(taGuild); socialWindow->removeTab(taParty); diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index ae79ab09..3a0a93e3 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -435,7 +435,7 @@ void InventoryHandler::event(Channels channel, { if (channel == CHANNEL_ITEM) { - if (event.getName() == "doCloseInventory") + if (event.getName() == EVENT_DOCLOSEINVENTORY) { // No need to worry about type MessageOut outMsg(CMSG_CLOSE_STORAGE); @@ -449,24 +449,24 @@ void InventoryHandler::event(Channels channel, int index = item->getInvIndex() + INVENTORY_OFFSET; - if (event.getName() == "doEquip") + if (event.getName() == EVENT_DOEQUIP) { MessageOut outMsg(CMSG_PLAYER_EQUIP); outMsg.writeInt16(index); outMsg.writeInt16(0); } - else if (event.getName() == "doUnequip") + else if (event.getName() == EVENT_DOUNEQUIP) { MessageOut outMsg(CMSG_PLAYER_UNEQUIP); outMsg.writeInt16(index); } - else if (event.getName() == "doUse") + else if (event.getName() == EVENT_DOUSE) { MessageOut outMsg(CMSG_PLAYER_INVENTORY_USE); outMsg.writeInt16(index); outMsg.writeInt32(item->getId()); // unused } - else if (event.getName() == "doDrop") + else if (event.getName() == EVENT_DODROP) { int amount = event.getInt("amount", 1); @@ -476,7 +476,7 @@ void InventoryHandler::event(Channels channel, outMsg.writeInt16(index); outMsg.writeInt16(amount); } - else if (event.getName() == "doMove") + else if (event.getName() == EVENT_DOMOVE) { int newIndex = event.getInt("newIndex", -1); diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 1f85e9a6..1b12b63f 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -85,14 +85,14 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) switch (msg.getId()) { case SMSG_NPC_CHOICE: - event = new Mana::Event("Menu"); + event = new Mana::Event(EVENT_MENU); event->setInt("id", npcId); parseMenu(event, msg.readString(msg.getLength() - 8)); event->trigger(CHANNEL_NPC); break; case SMSG_NPC_MESSAGE: - event = new Mana::Event("Message"); + event = new Mana::Event(EVENT_MESSAGE); event->setInt("id", npcId); event->setString("text", msg.readString(msg.getLength() - 8)); event->trigger(CHANNEL_NPC); @@ -100,28 +100,28 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) case SMSG_NPC_CLOSE: // Show the close button - event = new Mana::Event("Close"); + event = new Mana::Event(EVENT_CLOSE); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; case SMSG_NPC_NEXT: // Show the next button - event = new Mana::Event("Next"); + event = new Mana::Event(EVENT_NEXT); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; case SMSG_NPC_INT_INPUT: // Request for an integer - event = new Mana::Event("IntegerInput"); + event = new Mana::Event(EVENT_INTEGERINPUT); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; case SMSG_NPC_STR_INPUT: // Request for a string - event = new Mana::Event("StringInput"); + event = new Mana::Event(EVENT_STRINGINPUT); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; @@ -137,35 +137,35 @@ void NpcHandler::event(Channels channel, const Mana::Event &event) { if (channel == CHANNEL_NPC) { - if (event.getName() == "doTalk") + if (event.getName() == EVENT_DOTALK) { MessageOut outMsg(CMSG_NPC_TALK); outMsg.writeInt32(event.getInt("npcId")); outMsg.writeInt8(0); // Unused } - else if (event.getName() == "doNext") + else if (event.getName() == EVENT_DONEXT) { MessageOut outMsg(CMSG_NPC_NEXT_REQUEST); outMsg.writeInt32(event.getInt("npcId")); } - else if (event.getName() == "doClose") + else if (event.getName() == EVENT_DOCLOSE) { MessageOut outMsg(CMSG_NPC_CLOSE); outMsg.writeInt32(event.getInt("npcId")); } - else if (event.getName() == "doMenu") + else if (event.getName() == EVENT_DOMENU) { MessageOut outMsg(CMSG_NPC_LIST_CHOICE); outMsg.writeInt32(event.getInt("npcId")); outMsg.writeInt8(event.getInt("choice")); } - else if (event.getName() == "doIntegerInput") + else if (event.getName() == EVENT_DOINTEGERINPUT) { MessageOut outMsg(CMSG_NPC_INT_RESPONSE); outMsg.writeInt32(event.getInt("npcId")); outMsg.writeInt32(event.getInt("value")); } - else if (event.getName() == "doStringInput") + else if (event.getName() == EVENT_DOSTRINGINPUT) { const std::string &value = event.getString("value"); MessageOut outMsg(CMSG_NPC_STR_RESPONSE); diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index eeba7ae7..b82968a3 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -81,7 +81,7 @@ namespace { viewport->closePopupMenu(); - Mana::Event::trigger(CHANNEL_NPC, "CloseAll"); + Mana::Event::trigger(CHANNEL_NPC, EVENT_CLOSEALL); } } deathListener; diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index c8615485..034b959d 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -191,7 +191,7 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) // Successfully added item if (item->isEquippable() && item->isEquipped()) { - item->doEvent("doUnequip"); + item->doEvent(EVENT_DOUNEQUIP); } tradeWindow->addItem(item->getId(), true, quantity); |