diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-04-09 00:03:44 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-04-09 17:54:12 +0200 |
commit | 30d4b0adf4f17f05d1d62fc3428c896ef1079b6b (patch) | |
tree | acc6dab5d6894a949df3ab4d913ef72a1b1ebdca /src/net | |
parent | b499cf0c03f2589d36a1df14c81530347243940a (diff) | |
download | mana-30d4b0adf4f17f05d1d62fc3428c896ef1079b6b.tar.gz mana-30d4b0adf4f17f05d1d62fc3428c896ef1079b6b.tar.bz2 mana-30d4b0adf4f17f05d1d62fc3428c896ef1079b6b.tar.xz mana-30d4b0adf4f17f05d1d62fc3428c896ef1079b6b.zip |
Moved Events to Mana::Event::Type
Acked-by: Jared Adams
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/manaserv/chathandler.cpp | 7 | ||||
-rw-r--r-- | src/net/manaserv/generalhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/manaserv/inventoryhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/manaserv/npchandler.cpp | 30 | ||||
-rw-r--r-- | src/net/manaserv/playerhandler.cpp | 2 | ||||
-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 |
12 files changed, 59 insertions, 58 deletions
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp index 705795f4..07836c88 100644 --- a/src/net/manaserv/chathandler.cpp +++ b/src/net/manaserv/chathandler.cpp @@ -165,7 +165,8 @@ void ChatHandler::handleGameChatMessage(Net::MessageIn &msg) std::string mes = being->getName() + " : " + chatMsg; - Mana::Event event(being == player_node ? EVENT_PLAYER : EVENT_BEING); + Mana::Event event(being == player_node ? Mana::Event::Player + : Mana::Event::Being); event.setString("message", mes); event.setString("text", chatMsg); event.setString("nick", being->getName()); @@ -233,7 +234,7 @@ void ChatHandler::handlePrivateMessage(Net::MessageIn &msg) std::string userNick = msg.readString(); std::string chatMsg = msg.readString(); - Mana::Event event(EVENT_WHISPER); + Mana::Event event(Mana::Event::Whisper); event.setString("nick", userNick); event.setString("message", chatMsg); event.trigger(CHANNEL_CHAT); @@ -242,7 +243,7 @@ void ChatHandler::handlePrivateMessage(Net::MessageIn &msg) void ChatHandler::handleAnnouncement(Net::MessageIn &msg) { std::string chatMsg = msg.readString(); - Mana::Event event(EVENT_ANNOUNCEMENT); + Mana::Event event(Mana::Event::Announcement); event.setString("message", chatMsg); event.trigger(CHANNEL_CHAT); } diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp index d2151307..f40b2bc2 100644 --- a/src/net/manaserv/generalhandler.cpp +++ b/src/net/manaserv/generalhandler.cpp @@ -176,7 +176,7 @@ void GeneralHandler::event(Channels channel, { if (channel == CHANNEL_CLIENT) { - if (event.getName() == EVENT_STATECHANGE) + if (event.getType() == Mana::Event::StateChange) { int newState = event.getInt("newState"); @@ -186,7 +186,7 @@ void GeneralHandler::event(Channels channel, game->gameLoading(); } } - else if (event.getName() == EVENT_DBSLOADING) + else if (event.getType() == Mana::Event::LoadingDatabases) { Attributes::load(); Attributes::informItemDB(); @@ -194,7 +194,7 @@ void GeneralHandler::event(Channels channel, } else if (channel == CHANNEL_GAME) { - if (event.getName() == EVENT_GUIWINDOWSLOADED) + if (event.getType() == Mana::Event::GuiWindowsLoaded) { inventoryWindow->setSplitAllowed(true); skillDialog->loadSkills("mana-skills.xml"); diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp index 5edf3597..56280f40 100644 --- a/src/net/manaserv/inventoryhandler.cpp +++ b/src/net/manaserv/inventoryhandler.cpp @@ -120,13 +120,13 @@ void InventoryHandler::event(Channels channel, int index = item->getInvIndex(); - if (event.getName() == EVENT_DOEQUIP) + if (event.getType() == Mana::Event::DoEquip) { MessageOut msg(PGMSG_EQUIP); msg.writeInt8(index); gameServerConnection->send(msg); } - else if (event.getName() == EVENT_DOUNEQUIP) + else if (event.getType() == Mana::Event::DoUnequip) { MessageOut msg(PGMSG_UNEQUIP); msg.writeInt8(index); @@ -136,13 +136,13 @@ void InventoryHandler::event(Channels channel, // for instance. mEquips.setEquipment(index, 0, 0); } - else if (event.getName() == EVENT_DOUSE) + else if (event.getType() == Mana::Event::DoUse) { MessageOut msg(PGMSG_USE_ITEM); msg.writeInt8(index); gameServerConnection->send(msg); } - else if (event.getName() == EVENT_DODROP) + else if (event.getType() == Mana::Event::DoDrop) { int amount = event.getInt("amount", 1); @@ -151,7 +151,7 @@ void InventoryHandler::event(Channels channel, msg.writeInt8(amount); gameServerConnection->send(msg); } - else if (event.getName() == EVENT_DOSPLIT) + else if (event.getType() == Mana::Event::DoSplit) { int amount = event.getInt("amount", 1); @@ -165,7 +165,7 @@ void InventoryHandler::event(Channels channel, gameServerConnection->send(msg); } } - else if (event.getName() == EVENT_DOMOVE) + else if (event.getType() == Mana::Event::DoMove) { int newIndex = event.getInt("newIndex", -1); diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp index ca7d7415..91e57c72 100644 --- a/src/net/manaserv/npchandler.cpp +++ b/src/net/manaserv/npchandler.cpp @@ -67,7 +67,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) switch (msg.getId()) { case GPMSG_NPC_CHOICE: - event = new Mana::Event(EVENT_MENU); + event = new Mana::Event(Mana::Event::Menu); event->setInt("id", npcId); while (msg.getUnreadLength()) { @@ -79,7 +79,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) break; case GPMSG_NPC_NUMBER: - event = new Mana::Event(EVENT_INTEGERINPUT); + event = new Mana::Event(Mana::Event::IntegerInput); event->setInt("id", npcId); event->setInt("min", msg.readInt32()); event->setInt("max", msg.readInt32()); @@ -88,37 +88,37 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) break; case GPMSG_NPC_STRING: - event = new Mana::Event(EVENT_STRINGINPUT); + event = new Mana::Event(Mana::Event::StringInput); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; case GPMSG_NPC_POST: - event = new Mana::Event(EVENT_POST); + event = new Mana::Event(Mana::Event::Post); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; case GPMSG_NPC_ERROR: - event = new Mana::Event(EVENT_END); + event = new Mana::Event(Mana::Event::End); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; case GPMSG_NPC_MESSAGE: - event = new Mana::Event(EVENT_MESSAGE); + event = new Mana::Event(Mana::Event::Message); event->setInt("id", npcId); event->setString("text", msg.readString(msg.getUnreadLength())); event->trigger(CHANNEL_NPC); delete event; - event = new Mana::Event(EVENT_NEXT); + event = new Mana::Event(Mana::Event::Next); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; case GPMSG_NPC_CLOSE: - event = new Mana::Event(EVENT_CLOSE); + event = new Mana::Event(Mana::Event::Close); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; @@ -169,7 +169,7 @@ void NpcHandler::talk(int npcId) msg.writeInt16(npcId); gameServerConnection->send(msg); - Mana::Event event(EVENT_TALKSENT); + Mana::Event event(Mana::Event::TalkSent); event.setInt("npcId", npcId); event.trigger(CHANNEL_NPC); } @@ -180,7 +180,7 @@ void NpcHandler::nextDialog(int npcId) msg.writeInt16(npcId); gameServerConnection->send(msg); - Mana::Event event(EVENT_NEXTSENT); + Mana::Event event(Mana::Event::NextSent); event.setInt("npcId", npcId); event.trigger(CHANNEL_NPC); } @@ -191,7 +191,7 @@ void NpcHandler::closeDialog(int npcId) msg.writeInt16(npcId); gameServerConnection->send(msg); - Mana::Event event(EVENT_CLOSESENT); + Mana::Event event(Mana::Event::CloseSent); event.setInt("npcId", npcId); event.trigger(CHANNEL_NPC); } @@ -203,7 +203,7 @@ void NpcHandler::menuSelect(int npcId, int choice) msg.writeInt8(choice); gameServerConnection->send(msg); - Mana::Event event(EVENT_MENUSENT); + Mana::Event event(Mana::Event::MenuSent); event.setInt("npcId", npcId); event.setInt("choice", choice); event.trigger(CHANNEL_NPC); @@ -216,7 +216,7 @@ void NpcHandler::integerInput(int npcId, int value) msg.writeInt32(value); gameServerConnection->send(msg); - Mana::Event event(EVENT_INTEGERINPUTSENT); + Mana::Event event(Mana::Event::IntegerInputSent); event.setInt("npcId", npcId); event.setInt("value", value); event.trigger(CHANNEL_NPC); @@ -229,7 +229,7 @@ void NpcHandler::stringInput(int npcId, const std::string &value) msg.writeString(value); gameServerConnection->send(msg); - Mana::Event event(EVENT_STRINGINPUTSENT); + Mana::Event event(Mana::Event::StringInputSent); event.setInt("npcId", npcId); event.setString("value", value); event.trigger(CHANNEL_NPC); @@ -243,7 +243,7 @@ void NpcHandler::sendLetter(int npcId, const std::string &recipient, msg.writeString(text); gameServerConnection->send(msg); - Mana::Event event(EVENT_SENDLETTERSENT); + Mana::Event event(Mana::Event::SendLetterSent); event.setInt("npcId", npcId); event.setString("recipient", recipient); event.setString("text", text); diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index c071ca04..d3c8822b 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -65,7 +65,7 @@ void RespawnRequestListener::action(const gcn::ActionEvent &event) { Net::getPlayerHandler()->respawn(); - Mana::Event::trigger(CHANNEL_NPC, EVENT_CLOSEALL); + Mana::Event::trigger(CHANNEL_NPC, Mana::Event::CloseAll); } PlayerHandler::PlayerHandler() diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 33826762..5dc1206f 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(EVENT_WHISPERERROR); + Mana::Event event(Mana::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(EVENT_WHISPERERROR); + Mana::Event event(Mana::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(EVENT_WHISPER); + Mana::Event event(Mana::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(EVENT_BEING); + Mana::Event event(Mana::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(EVENT_PLAYER); + Mana::Event event(Mana::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(EVENT_ANNOUNCEMENT); + Mana::Event event(Mana::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 63f5fcec..3063c044 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() == EVENT_ENGINESINITALIZED) + if (event.getType() == Mana::Event::EnginesInitialized) { Game::instance()->changeMap(mMap); } - else if (event.getName() == EVENT_MAPLOADED) + else if (event.getType() == Mana::Event::MapLoaded) { MessageOut outMsg(CMSG_MAP_LOADED); } diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 1935ad72..7000c96c 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() == EVENT_GUIWINDOWSLOADED) + if (event.getType() == Mana::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() == EVENT_GUIWINDOWSUNLOADING) + else if (event.getType() == Mana::Event::GuiWindowsUnloading) { socialWindow->removeTab(taGuild); socialWindow->removeTab(taParty); diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 1d99eca4..5ab6af08 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -436,7 +436,7 @@ void InventoryHandler::event(Channels channel, { if (channel == CHANNEL_ITEM) { - if (event.getName() == EVENT_DOCLOSEINVENTORY) + if (event.getType() == Mana::Event::DoCloseInventory) { // No need to worry about type MessageOut outMsg(CMSG_CLOSE_STORAGE); @@ -450,24 +450,24 @@ void InventoryHandler::event(Channels channel, int index = item->getInvIndex() + INVENTORY_OFFSET; - if (event.getName() == EVENT_DOEQUIP) + if (event.getType() == Mana::Event::DoEquip) { MessageOut outMsg(CMSG_PLAYER_EQUIP); outMsg.writeInt16(index); outMsg.writeInt16(0); } - else if (event.getName() == EVENT_DOUNEQUIP) + else if (event.getType() == Mana::Event::DoUnequip) { MessageOut outMsg(CMSG_PLAYER_UNEQUIP); outMsg.writeInt16(index); } - else if (event.getName() == EVENT_DOUSE) + else if (event.getType() == Mana::Event::DoUse) { MessageOut outMsg(CMSG_PLAYER_INVENTORY_USE); outMsg.writeInt16(index); outMsg.writeInt32(item->getId()); // unused } - else if (event.getName() == EVENT_DODROP) + else if (event.getType() == Mana::Event::DoDrop) { int amount = event.getInt("amount", 1); @@ -477,7 +477,7 @@ void InventoryHandler::event(Channels channel, outMsg.writeInt16(index); outMsg.writeInt16(amount); } - else if (event.getName() == EVENT_DOMOVE) + else if (event.getType() == Mana::Event::DoMove) { int newIndex = event.getInt("newIndex", -1); diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 337226a9..85b3b284 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -83,14 +83,14 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) switch (msg.getId()) { case SMSG_NPC_CHOICE: - event = new Mana::Event(EVENT_MENU); + event = new Mana::Event(Mana::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(EVENT_MESSAGE); + event = new Mana::Event(Mana::Event::Message); event->setInt("id", npcId); event->setString("text", msg.readString(msg.getLength() - 8)); event->trigger(CHANNEL_NPC); @@ -98,28 +98,28 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) case SMSG_NPC_CLOSE: // Show the close button - event = new Mana::Event(EVENT_CLOSE); + event = new Mana::Event(Mana::Event::Close); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; case SMSG_NPC_NEXT: // Show the next button - event = new Mana::Event(EVENT_NEXT); + event = new Mana::Event(Mana::Event::Next); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; case SMSG_NPC_INT_INPUT: // Request for an integer - event = new Mana::Event(EVENT_INTEGERINPUT); + event = new Mana::Event(Mana::Event::IntegerInput); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; case SMSG_NPC_STR_INPUT: // Request for a string - event = new Mana::Event(EVENT_STRINGINPUT); + event = new Mana::Event(Mana::Event::StringInput); event->setInt("id", npcId); event->trigger(CHANNEL_NPC); break; @@ -177,7 +177,7 @@ void NpcHandler::talk(int npcId) outMsg.writeInt32(npcId); outMsg.writeInt8(0); // Unused - Mana::Event event(EVENT_TALKSENT); + Mana::Event event(Mana::Event::TalkSent); event.setInt("npcId", npcId); event.trigger(CHANNEL_NPC); } @@ -187,7 +187,7 @@ void NpcHandler::nextDialog(int npcId) MessageOut outMsg(CMSG_NPC_NEXT_REQUEST); outMsg.writeInt32(npcId); - Mana::Event event(EVENT_NEXTSENT); + Mana::Event event(Mana::Event::NextSent); event.setInt("npcId", npcId); event.trigger(CHANNEL_NPC); } @@ -197,7 +197,7 @@ void NpcHandler::closeDialog(int npcId) MessageOut outMsg(CMSG_NPC_CLOSE); outMsg.writeInt32(npcId); - Mana::Event event(EVENT_CLOSESENT); + Mana::Event event(Mana::Event::CloseSent); event.setInt("npcId", npcId); event.trigger(CHANNEL_NPC); } @@ -208,7 +208,7 @@ void NpcHandler::menuSelect(int npcId, int choice) outMsg.writeInt32(npcId); outMsg.writeInt8(choice); - Mana::Event event(EVENT_MENUSENT); + Mana::Event event(Mana::Event::MenuSent); event.setInt("npcId", npcId); event.setInt("choice", choice); event.trigger(CHANNEL_NPC); @@ -220,7 +220,7 @@ void NpcHandler::integerInput(int npcId, int value) outMsg.writeInt32(npcId); outMsg.writeInt32(value); - Mana::Event event(EVENT_INTEGERINPUTSENT); + Mana::Event event(Mana::Event::IntegerInputSent); event.setInt("npcId", npcId); event.setInt("value", value); event.trigger(CHANNEL_NPC); @@ -234,7 +234,7 @@ void NpcHandler::stringInput(int npcId, const std::string &value) outMsg.writeString(value, value.length()); outMsg.writeInt8(0); // Prevent problems with string reading - Mana::Event event(EVENT_STRINGINPUTSENT); + Mana::Event event(Mana::Event::StringInputSent); event.setInt("npcId", npcId); event.setString("value", value); event.trigger(CHANNEL_NPC); diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 725a00cc..64dda9d4 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, EVENT_CLOSEALL); + Mana::Event::trigger(CHANNEL_NPC, Mana::Event::CloseAll); } } deathListener; diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 034b959d..80249784 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(EVENT_DOUNEQUIP); + item->doEvent(Mana::Event::DoUnequip); } tradeWindow->addItem(item->getId(), true, quantity); |