From 30d4b0adf4f17f05d1d62fc3428c896ef1079b6b Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 9 Apr 2011 00:03:44 +0200 Subject: Moved Events to Mana::Event::Type Acked-by: Jared Adams --- src/net/manaserv/chathandler.cpp | 7 ++++--- src/net/manaserv/generalhandler.cpp | 6 +++--- src/net/manaserv/inventoryhandler.cpp | 12 ++++++------ src/net/manaserv/npchandler.cpp | 30 +++++++++++++++--------------- src/net/manaserv/playerhandler.cpp | 2 +- 5 files changed, 29 insertions(+), 28 deletions(-) (limited to 'src/net/manaserv') 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() -- cgit v1.2.3-70-g09d2