From 84d2bab38202cd52b5eb0a37c12204ab6f607915 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 2 Sep 2015 20:58:41 +0300 Subject: Remove MessageHandler class --- src/net/tmwa/adminhandler.cpp | 22 ----- src/net/tmwa/adminhandler.h | 9 +- src/net/tmwa/auctionhandler.cpp | 12 +-- src/net/tmwa/auctionhandler.h | 6 +- src/net/tmwa/bankhandler.cpp | 12 +-- src/net/tmwa/bankhandler.h | 7 +- src/net/tmwa/battlegroundhandler.cpp | 12 +-- src/net/tmwa/battlegroundhandler.h | 7 +- src/net/tmwa/beinghandler.cpp | 166 ----------------------------------- src/net/tmwa/beinghandler.h | 6 +- src/net/tmwa/buyingstorehandler.cpp | 12 +-- src/net/tmwa/buyingstorehandler.h | 7 +- src/net/tmwa/buysellhandler.cpp | 42 --------- src/net/tmwa/buysellhandler.h | 6 +- src/net/tmwa/cashshophandler.cpp | 12 +-- src/net/tmwa/cashshophandler.h | 7 +- src/net/tmwa/charserverhandler.cpp | 57 ------------ src/net/tmwa/charserverhandler.h | 7 +- src/net/tmwa/charserverrecv.cpp | 1 + src/net/tmwa/chathandler.cpp | 59 ------------- src/net/tmwa/chathandler.h | 6 +- src/net/tmwa/elementalhandler.cpp | 17 +--- src/net/tmwa/elementalhandler.h | 18 ++-- src/net/tmwa/familyhandler.cpp | 12 +-- src/net/tmwa/familyhandler.h | 7 +- src/net/tmwa/friendshandler.cpp | 17 +--- src/net/tmwa/friendshandler.h | 7 +- src/net/tmwa/gamehandler.cpp | 43 --------- src/net/tmwa/gamehandler.h | 6 +- src/net/tmwa/generalhandler.cpp | 25 +----- src/net/tmwa/generalhandler.h | 112 +++++++++++++++-------- src/net/tmwa/guildhandler.cpp | 153 +------------------------------- src/net/tmwa/guildhandler.h | 6 +- src/net/tmwa/homunculushandler.cpp | 12 +-- src/net/tmwa/homunculushandler.h | 7 +- src/net/tmwa/inventoryhandler.cpp | 97 -------------------- src/net/tmwa/inventoryhandler.h | 7 +- src/net/tmwa/itemhandler.cpp | 32 ------- src/net/tmwa/itemhandler.h | 6 +- src/net/tmwa/loginhandler.cpp | 42 --------- src/net/tmwa/loginhandler.h | 6 +- src/net/tmwa/mailhandler.cpp | 12 +-- src/net/tmwa/mailhandler.h | 6 +- src/net/tmwa/maphandler.cpp | 12 +-- src/net/tmwa/maphandler.h | 8 +- src/net/tmwa/markethandler.cpp | 17 +--- src/net/tmwa/markethandler.h | 7 +- src/net/tmwa/mercenaryhandler.cpp | 12 +-- src/net/tmwa/mercenaryhandler.h | 7 +- src/net/tmwa/messagehandler.cpp | 50 ----------- src/net/tmwa/messagehandler.h | 52 ----------- src/net/tmwa/network.cpp | 17 ---- src/net/tmwa/network.h | 6 -- src/net/tmwa/npchandler.cpp | 63 +------------ src/net/tmwa/npchandler.h | 6 +- src/net/tmwa/partyhandler.cpp | 58 ------------ src/net/tmwa/partyhandler.h | 6 +- src/net/tmwa/pethandler.cpp | 12 --- src/net/tmwa/pethandler.h | 6 +- src/net/tmwa/playerhandler.cpp | 68 -------------- src/net/tmwa/playerhandler.h | 6 +- src/net/tmwa/playerrecv.h | 2 - src/net/tmwa/questhandler.cpp | 27 ------ src/net/tmwa/questhandler.h | 7 +- src/net/tmwa/questrecv.cpp | 2 + src/net/tmwa/questrecv.h | 7 +- src/net/tmwa/roulettehandler.cpp | 17 +--- src/net/tmwa/roulettehandler.h | 7 +- src/net/tmwa/searchstorehandler.cpp | 17 +--- src/net/tmwa/searchstorehandler.h | 7 +- src/net/tmwa/skillhandler.cpp | 32 ------- src/net/tmwa/skillhandler.h | 6 +- src/net/tmwa/skillrecv.cpp | 2 + src/net/tmwa/skillrecv.h | 5 +- src/net/tmwa/tradehandler.cpp | 53 ----------- src/net/tmwa/tradehandler.h | 6 +- src/net/tmwa/traderecv.cpp | 5 +- src/net/tmwa/traderecv.h | 2 - src/net/tmwa/vendinghandler.cpp | 12 +-- src/net/tmwa/vendinghandler.h | 7 +- 80 files changed, 153 insertions(+), 1608 deletions(-) delete mode 100644 src/net/tmwa/messagehandler.cpp delete mode 100644 src/net/tmwa/messagehandler.h (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index 834a29c43..fa2f012f1 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -41,33 +41,11 @@ namespace TmwAthena { AdminHandler::AdminHandler() : - MessageHandler(), Ea::AdminHandler() { - static const uint16_t _messages[] = - { - SMSG_ADMIN_KICK_ACK, - 0 - }; - handledMessages = _messages; adminHandler = this; } -void AdminHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("AdminHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_ADMIN_KICK_ACK: - Ea::AdminRecv::processKickAck(msg); - break; - - default: - break; - } - BLOCK_END("AdminHandler::handleMessage") -} - void AdminHandler::announce(const std::string &text) const { createOutPacket(CMSG_ADMIN_ANNOUNCE); diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index a98d6d850..7fa28ce2b 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -25,20 +25,21 @@ #include "net/ea/adminhandler.h" -#include "net/tmwa/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace TmwAthena { -class AdminHandler final : public MessageHandler, public Ea::AdminHandler +class AdminHandler final : public Ea::AdminHandler { public: AdminHandler(); A_DELETE_COPY(AdminHandler) - void handleMessage(Net::MessageIn &msg) override final; - void announce(const std::string &text) const override final; void localAnnounce(const std::string &text) const override final; diff --git a/src/net/tmwa/auctionhandler.cpp b/src/net/tmwa/auctionhandler.cpp index e63b76a00..91fa7116f 100644 --- a/src/net/tmwa/auctionhandler.cpp +++ b/src/net/tmwa/auctionhandler.cpp @@ -27,21 +27,11 @@ extern Net::AuctionHandler *auctionHandler; namespace TmwAthena { -AuctionHandler::AuctionHandler() : - MessageHandler() +AuctionHandler::AuctionHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; auctionHandler = this; } -void AuctionHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void AuctionHandler::cancelReg() const { } diff --git a/src/net/tmwa/auctionhandler.h b/src/net/tmwa/auctionhandler.h index 5df04b778..d4acb42b4 100644 --- a/src/net/tmwa/auctionhandler.h +++ b/src/net/tmwa/auctionhandler.h @@ -25,19 +25,15 @@ #include "net/auctionhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class AuctionHandler final : public MessageHandler, public Net::AuctionHandler +class AuctionHandler final : public Net::AuctionHandler { public: AuctionHandler(); A_DELETE_COPY(AuctionHandler) - void handleMessage(Net::MessageIn &msg) override final; - void cancelReg() const override final; void setItem(const Item *const item, diff --git a/src/net/tmwa/bankhandler.cpp b/src/net/tmwa/bankhandler.cpp index 946f2e806..2126536d4 100644 --- a/src/net/tmwa/bankhandler.cpp +++ b/src/net/tmwa/bankhandler.cpp @@ -27,21 +27,11 @@ extern Net::BankHandler *bankHandler; namespace TmwAthena { -BankHandler::BankHandler() : - MessageHandler() +BankHandler::BankHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; bankHandler = this; } -void BankHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void BankHandler::deposit(const int money A_UNUSED) const { } diff --git a/src/net/tmwa/bankhandler.h b/src/net/tmwa/bankhandler.h index b56c03c86..dfa9fbb1f 100644 --- a/src/net/tmwa/bankhandler.h +++ b/src/net/tmwa/bankhandler.h @@ -25,21 +25,16 @@ #include "net/bankhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class BankHandler final : public MessageHandler, - public Net::BankHandler +class BankHandler final : public Net::BankHandler { public: BankHandler(); A_DELETE_COPY(BankHandler) - void handleMessage(Net::MessageIn &msg) override final; - void deposit(const int money) const override final; void withdraw(const int money) const override final; diff --git a/src/net/tmwa/battlegroundhandler.cpp b/src/net/tmwa/battlegroundhandler.cpp index 31dbc1006..09261ba69 100644 --- a/src/net/tmwa/battlegroundhandler.cpp +++ b/src/net/tmwa/battlegroundhandler.cpp @@ -27,21 +27,11 @@ extern Net::BattleGroundHandler *battleGroundHandler; namespace TmwAthena { -BattleGroundHandler::BattleGroundHandler() : - MessageHandler() +BattleGroundHandler::BattleGroundHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; battleGroundHandler = this; } -void BattleGroundHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void BattleGroundHandler::registerBg(const BattleGroundTypeT &type A_UNUSED, const std::string &name A_UNUSED) const diff --git a/src/net/tmwa/battlegroundhandler.h b/src/net/tmwa/battlegroundhandler.h index 1755bb980..63687fad9 100644 --- a/src/net/tmwa/battlegroundhandler.h +++ b/src/net/tmwa/battlegroundhandler.h @@ -25,21 +25,16 @@ #include "net/battlegroundhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class BattleGroundHandler final : public MessageHandler, - public Net::BattleGroundHandler +class BattleGroundHandler final : public Net::BattleGroundHandler { public: BattleGroundHandler(); A_DELETE_COPY(BattleGroundHandler) - void handleMessage(Net::MessageIn &msg) override final; - void registerBg(const BattleGroundTypeT &type, const std::string &name) const override final; diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index cf0df34e4..b3529b53c 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -38,44 +38,8 @@ namespace TmwAthena { BeingHandler::BeingHandler(const bool enableSync) : - MessageHandler(), Ea::BeingHandler(enableSync) { - static const uint16_t _messages[] = - { - SMSG_BEING_VISIBLE, - SMSG_BEING_MOVE, - SMSG_BEING_MOVE2, - SMSG_BEING_REMOVE, - SMSG_SKILL_DAMAGE, - SMSG_BEING_ACTION, - SMSG_BEING_SELFEFFECT, - SMSG_BEING_EMOTION, - SMSG_BEING_CHANGE_LOOKS, - SMSG_BEING_CHANGE_LOOKS2, - SMSG_BEING_NAME_RESPONSE, - SMSG_PLAYER_GUILD_PARTY_INFO, - SMSG_BEING_CHANGE_DIRECTION, - SMSG_PLAYER_UPDATE_1, - SMSG_PLAYER_UPDATE_2, - SMSG_PLAYER_MOVE, - SMSG_PLAYER_STOP, - SMSG_PLAYER_MOVE_TO_ATTACK, - SMSG_PLAYER_STATUS_CHANGE, - SMSG_BEING_STATUS_CHANGE, - SMSG_BEING_RESURRECT, - SMSG_SOLVE_CHAR_NAME, - SMSG_BEING_SPAWN, - SMSG_SKILL_CASTING, - SMSG_SKILL_CAST_CANCEL, - SMSG_SKILL_NO_DAMAGE, - SMSG_BEING_IP_RESPONSE, - SMSG_PVP_MAP_MODE, - SMSG_PVP_SET, - SMSG_BEING_MOVE3, - 0 - }; - handledMessages = _messages; beingHandler = this; } @@ -85,136 +49,6 @@ void BeingHandler::requestNameById(const BeingId id) const outMsg.writeBeingId(id, "being id"); } -void BeingHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("BeingHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_BEING_VISIBLE: - BeingRecv::processBeingVisible(msg); - break; - - case SMSG_BEING_MOVE: - BeingRecv::processBeingMove(msg); - break; - - case SMSG_BEING_MOVE2: - BeingRecv::processBeingMove2(msg); - break; - - case SMSG_BEING_MOVE3: - Ea::BeingRecv::processBeingMove3(msg); - break; - - case SMSG_BEING_SPAWN: - BeingRecv::processBeingSpawn(msg); - break; - - case SMSG_BEING_REMOVE: - Ea::BeingRecv::processBeingRemove(msg); - break; - - case SMSG_BEING_RESURRECT: - BeingRecv::processBeingResurrect(msg); - break; - - case SMSG_SKILL_DAMAGE: - Ea::BeingRecv::processSkillDamage(msg); - break; - - case SMSG_BEING_ACTION: - Ea::BeingRecv::processBeingAction(msg); - break; - - case SMSG_BEING_SELFEFFECT: - BeingRecv::processBeingSelfEffect(msg); - break; - - case SMSG_BEING_EMOTION: - Ea::BeingRecv::processBeingEmotion(msg); - break; - - case SMSG_BEING_CHANGE_LOOKS: - BeingRecv::processBeingChangeLook(msg); - break; - - case SMSG_BEING_CHANGE_LOOKS2: - BeingRecv::processBeingChangeLook2(msg); - break; - - case SMSG_BEING_NAME_RESPONSE: - Ea::BeingRecv::processNameResponse(msg); - break; - - case SMSG_BEING_IP_RESPONSE: - BeingRecv::processIpResponse(msg); - break; - - case SMSG_SOLVE_CHAR_NAME: - break; - - case SMSG_PLAYER_GUILD_PARTY_INFO: - BeingRecv::processPlayerGuilPartyInfo(msg); - break; - - case SMSG_BEING_CHANGE_DIRECTION: - BeingRecv::processBeingChangeDirection(msg); - break; - - case SMSG_PLAYER_UPDATE_1: - BeingRecv::processPlayerUpdate1(msg); - break; - - case SMSG_PLAYER_UPDATE_2: - BeingRecv::processPlayerUpdate2(msg); - break; - - case SMSG_PLAYER_MOVE: - BeingRecv::processPlayerMove(msg); - break; - - case SMSG_PLAYER_STOP: - Ea::BeingRecv::processPlayerStop(msg); - break; - - case SMSG_PLAYER_MOVE_TO_ATTACK: - Ea::BeingRecv::processPlayerMoveToAttack(msg); - break; - - case SMSG_PLAYER_STATUS_CHANGE: - BeingRecv::processPlaterStatusChange(msg); - break; - - case SMSG_BEING_STATUS_CHANGE: - BeingRecv::processBeingStatusChange(msg); - break; - - case SMSG_SKILL_CASTING: - BeingRecv::processSkillCasting(msg); - break; - - case SMSG_SKILL_CAST_CANCEL: - BeingRecv::processSkillCastCancel(msg); - break; - - case SMSG_SKILL_NO_DAMAGE: - Ea::BeingRecv::processSkillNoDamage(msg); - break; - - case SMSG_PVP_MAP_MODE: - Ea::BeingRecv::processPvpMapMode(msg); - break; - - case SMSG_PVP_SET: - BeingRecv::processPvpSet(msg); - break; - - default: - break; - } - BLOCK_END("BeingHandler::handleMessage") -} - void BeingHandler::undress(Being *const being) const { if (!being) diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h index a11415531..1776ddd96 100644 --- a/src/net/tmwa/beinghandler.h +++ b/src/net/tmwa/beinghandler.h @@ -25,20 +25,16 @@ #include "net/ea/beinghandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class BeingHandler final : public MessageHandler, public Ea::BeingHandler +class BeingHandler final : public Ea::BeingHandler { public: explicit BeingHandler(const bool enableSync); A_DELETE_COPY(BeingHandler) - void handleMessage(Net::MessageIn &msg) override final; - void requestNameById(const BeingId id) const override final; void undress(Being *const being) const override final; diff --git a/src/net/tmwa/buyingstorehandler.cpp b/src/net/tmwa/buyingstorehandler.cpp index 245775c24..53fc45858 100644 --- a/src/net/tmwa/buyingstorehandler.cpp +++ b/src/net/tmwa/buyingstorehandler.cpp @@ -27,21 +27,11 @@ extern Net::BuyingStoreHandler *buyingStoreHandler; namespace TmwAthena { -BuyingStoreHandler::BuyingStoreHandler() : - MessageHandler() +BuyingStoreHandler::BuyingStoreHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; buyingStoreHandler = this; } -void BuyingStoreHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void BuyingStoreHandler::create(const std::string &name A_UNUSED, const int maxMoney A_UNUSED, const bool flag A_UNUSED, diff --git a/src/net/tmwa/buyingstorehandler.h b/src/net/tmwa/buyingstorehandler.h index dc1b408bb..bfbb71080 100644 --- a/src/net/tmwa/buyingstorehandler.h +++ b/src/net/tmwa/buyingstorehandler.h @@ -25,21 +25,16 @@ #include "net/buyingstorehandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class BuyingStoreHandler final : public MessageHandler, - public Net::BuyingStoreHandler +class BuyingStoreHandler final : public Net::BuyingStoreHandler { public: BuyingStoreHandler(); A_DELETE_COPY(BuyingStoreHandler) - void handleMessage(Net::MessageIn &msg) override final; - void create(const std::string &name, const int maxMoney, const bool flag, diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 963a40a5f..b2582a595 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -44,54 +44,12 @@ namespace TmwAthena { BuySellHandler::BuySellHandler() : - MessageHandler(), Ea::BuySellHandler() { - static const uint16_t _messages[] = - { - SMSG_NPC_BUY_SELL_CHOICE, - SMSG_NPC_BUY, - SMSG_NPC_SELL, - SMSG_NPC_BUY_RESPONSE, - SMSG_NPC_SELL_RESPONSE, - 0 - }; - handledMessages = _messages; buySellHandler = this; Ea::BuySellRecv::mBuyDialog = nullptr; } -void BuySellHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("BuySellHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_NPC_BUY_SELL_CHOICE: - Ea::BuySellRecv::processNpcBuySellChoice(msg); - break; - - case SMSG_NPC_BUY: - BuySellRecv::processNpcBuy(msg); - break; - - case SMSG_NPC_SELL: - Ea::BuySellRecv::processNpcSell(msg); - break; - - case SMSG_NPC_BUY_RESPONSE: - Ea::BuySellRecv::processNpcBuyResponse(msg); - break; - - case SMSG_NPC_SELL_RESPONSE: - BuySellRecv::processNpcSellResponse(msg); - break; - - default: - break; - } - BLOCK_END("BuySellHandler::handleMessage") -} - void BuySellHandler::requestSellList(const std::string &nick) const { if (nick.empty() != 0 || !shopWindow) diff --git a/src/net/tmwa/buysellhandler.h b/src/net/tmwa/buysellhandler.h index d02497a1d..7ed1b83d4 100644 --- a/src/net/tmwa/buysellhandler.h +++ b/src/net/tmwa/buysellhandler.h @@ -25,20 +25,16 @@ #include "net/ea/buysellhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class BuySellHandler final : public MessageHandler, public Ea::BuySellHandler +class BuySellHandler final : public Ea::BuySellHandler { public: BuySellHandler(); A_DELETE_COPY(BuySellHandler) - void handleMessage(Net::MessageIn &msg) override final; - void requestSellList(const std::string &nick) const override final; diff --git a/src/net/tmwa/cashshophandler.cpp b/src/net/tmwa/cashshophandler.cpp index 45a4aaacb..a0b6d64cd 100644 --- a/src/net/tmwa/cashshophandler.cpp +++ b/src/net/tmwa/cashshophandler.cpp @@ -27,21 +27,11 @@ extern Net::CashShopHandler *cashShopHandler; namespace TmwAthena { -CashShopHandler::CashShopHandler() : - MessageHandler() +CashShopHandler::CashShopHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; cashShopHandler = this; } -void CashShopHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void CashShopHandler::buyItem(const int points A_UNUSED, const int itemId A_UNUSED, const ItemColor color A_UNUSED, diff --git a/src/net/tmwa/cashshophandler.h b/src/net/tmwa/cashshophandler.h index 3b4c668ec..7d90067c8 100644 --- a/src/net/tmwa/cashshophandler.h +++ b/src/net/tmwa/cashshophandler.h @@ -25,21 +25,16 @@ #include "net/cashshophandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class CashShopHandler final : public MessageHandler, - public Net::CashShopHandler +class CashShopHandler final : public Net::CashShopHandler { public: CashShopHandler(); A_DELETE_COPY(CashShopHandler) - void handleMessage(Net::MessageIn &msg) override final; - void buyItem(const int points, const int itemId, const ItemColor color, diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index c5afb012e..487e0bbfc 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -54,68 +54,11 @@ extern ServerInfo mapServer; extern ServerInfo charServer; CharServerHandler::CharServerHandler() : - MessageHandler(), Ea::CharServerHandler() { - static const uint16_t _messages[] = - { - SMSG_CHAR_LOGIN, - SMSG_CHAR_LOGIN_ERROR, - SMSG_CHAR_CREATE_SUCCEEDED, - SMSG_CHAR_CREATE_FAILED, - SMSG_CHAR_DELETE_SUCCEEDED, - SMSG_CHAR_DELETE_FAILED, - SMSG_CHAR_MAP_INFO, - SMSG_CHANGE_MAP_SERVER, - 0 - }; - handledMessages = _messages; charServerHandler = this; } -void CharServerHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("CharServerHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_CHAR_LOGIN: - CharServerRecv::processCharLogin(msg); - break; - - case SMSG_CHAR_LOGIN_ERROR: - Ea::CharServerRecv::processCharLoginError(msg); - break; - - case SMSG_CHAR_CREATE_SUCCEEDED: - CharServerRecv::processCharCreate(msg); - break; - - case SMSG_CHAR_CREATE_FAILED: - Ea::CharServerRecv::processCharCreateFailed(msg); - break; - - case SMSG_CHAR_DELETE_SUCCEEDED: - Ea::CharServerRecv::processCharDelete(msg); - break; - - case SMSG_CHAR_DELETE_FAILED: - CharServerRecv::processCharDeleteFailed(msg); - break; - - case SMSG_CHAR_MAP_INFO: - CharServerRecv::processCharMapInfo(msg); - break; - - case SMSG_CHANGE_MAP_SERVER: - CharServerRecv::processChangeMapServer(msg); - break; - - default: - break; - } - BLOCK_END("CharServerHandler::handleMessage") -} - void CharServerHandler::chooseCharacter(Net::Character *const character) { if (!character) diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h index 39c561213..b141fc7bc 100644 --- a/src/net/tmwa/charserverhandler.h +++ b/src/net/tmwa/charserverhandler.h @@ -25,24 +25,19 @@ #include "net/ea/charserverhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { /** * Deals with incoming messages from the character server. */ -class CharServerHandler final : public MessageHandler, - public Ea::CharServerHandler +class CharServerHandler final : public Ea::CharServerHandler { public: CharServerHandler(); A_DELETE_COPY(CharServerHandler) - void handleMessage(Net::MessageIn &msg) override final; - void chooseCharacter(Net::Character *const character) override final; void newCharacter(const std::string &name, diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp index 4d9998ab2..f2e1b0943 100644 --- a/src/net/tmwa/charserverrecv.cpp +++ b/src/net/tmwa/charserverrecv.cpp @@ -33,6 +33,7 @@ #include "net/character.h" #include "net/charserverhandler.h" +#include "net/messagein.h" #include "net/ea/token.h" diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index ad34acb61..a3071c1a5 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -44,70 +44,11 @@ namespace TmwAthena { ChatHandler::ChatHandler() : - MessageHandler(), Ea::ChatHandler() { - static const uint16_t _messages[] = - { - SMSG_BEING_CHAT, - SMSG_PLAYER_CHAT, - SMSG_WHISPER, - SMSG_WHISPER_RESPONSE, - SMSG_GM_CHAT, - SMSG_MVP_EFFECT, - SMSG_IGNORE_ALL_RESPONSE, - SMSG_SCRIPT_MESSAGE, - 0 - }; - handledMessages = _messages; chatHandler = this; } -void ChatHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("ChatHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_WHISPER_RESPONSE: - ChatRecv::processWhisperResponse(msg); - break; - - // Received whisper - case SMSG_WHISPER: - ChatRecv::processWhisper(msg); - break; - - // Received speech from being - case SMSG_BEING_CHAT: - ChatRecv::processBeingChat(msg); - break; - - case SMSG_PLAYER_CHAT: - ChatRecv::processChat(msg); - break; - - case SMSG_GM_CHAT: - ChatRecv::processGmChat(msg); - break; - - case SMSG_MVP_EFFECT: - Ea::ChatRecv::processMVPEffect(msg); - break; - - case SMSG_IGNORE_ALL_RESPONSE: - Ea::ChatRecv::processIgnoreAllResponse(msg); - break; - - case SMSG_SCRIPT_MESSAGE: - ChatRecv::processScriptMessage(msg); - break; - - default: - break; - } - BLOCK_END("ChatHandler::handleMessage") -} - void ChatHandler::talk(const std::string &restrict text, const std::string &restrict channel A_UNUSED) const { diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h index 4bab1f050..ba591225b 100644 --- a/src/net/tmwa/chathandler.h +++ b/src/net/tmwa/chathandler.h @@ -25,21 +25,17 @@ #include "net/ea/chathandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { class MessageOut; -class ChatHandler final : public MessageHandler, public Ea::ChatHandler +class ChatHandler final : public Ea::ChatHandler { public: ChatHandler(); A_DELETE_COPY(ChatHandler) - void handleMessage(Net::MessageIn &msg) override final; - void talk(const std::string &restrict text, const std::string &restrict channel) const override final; diff --git a/src/net/tmwa/elementalhandler.cpp b/src/net/tmwa/elementalhandler.cpp index 5ea0f11d6..56ef699c8 100644 --- a/src/net/tmwa/elementalhandler.cpp +++ b/src/net/tmwa/elementalhandler.cpp @@ -27,24 +27,9 @@ extern Net::ElementalHandler *elementalHandler; namespace TmwAthena { -ElementalHandler::ElementalHandler() : - MessageHandler() +ElementalHandler::ElementalHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; elementalHandler = this; } -void ElementalHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - default: - break; - } -} - } // namespace TmwAthena diff --git a/src/net/tmwa/elementalhandler.h b/src/net/tmwa/elementalhandler.h index bacb7260e..f68805c61 100644 --- a/src/net/tmwa/elementalhandler.h +++ b/src/net/tmwa/elementalhandler.h @@ -25,21 +25,15 @@ #include "net/elementalhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class ElementalHandler final : public MessageHandler, - public Net::ElementalHandler -{ - public: - ElementalHandler(); - - A_DELETE_COPY(ElementalHandler) - - void handleMessage(Net::MessageIn &msg) override final; -}; + class ElementalHandler final : public Net::ElementalHandler + { + public: + ElementalHandler(); + A_DELETE_COPY(ElementalHandler) + }; } // namespace TmwAthena #endif // EATHENA_SUPPORT diff --git a/src/net/tmwa/familyhandler.cpp b/src/net/tmwa/familyhandler.cpp index b5502e388..58a0bf629 100644 --- a/src/net/tmwa/familyhandler.cpp +++ b/src/net/tmwa/familyhandler.cpp @@ -27,21 +27,11 @@ extern Net::FamilyHandler *familyHandler; namespace TmwAthena { -FamilyHandler::FamilyHandler() : - MessageHandler() +FamilyHandler::FamilyHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; familyHandler = this; } -void FamilyHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void FamilyHandler::askForChild(const Being *const being A_UNUSED) { } diff --git a/src/net/tmwa/familyhandler.h b/src/net/tmwa/familyhandler.h index e284312b9..ff6328f65 100644 --- a/src/net/tmwa/familyhandler.h +++ b/src/net/tmwa/familyhandler.h @@ -25,21 +25,16 @@ #include "net/familyhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class FamilyHandler final : public MessageHandler, - public Net::FamilyHandler +class FamilyHandler final : public Net::FamilyHandler { public: FamilyHandler(); A_DELETE_COPY(FamilyHandler) - void handleMessage(Net::MessageIn &msg) override final; - void askForChild(const Being *const being) override final; void askForChildReply(const bool accept) override final; diff --git a/src/net/tmwa/friendshandler.cpp b/src/net/tmwa/friendshandler.cpp index a575ecd95..41081bc70 100644 --- a/src/net/tmwa/friendshandler.cpp +++ b/src/net/tmwa/friendshandler.cpp @@ -27,26 +27,11 @@ extern Net::FriendsHandler *friendsHandler; namespace TmwAthena { -FriendsHandler::FriendsHandler() : - MessageHandler() +FriendsHandler::FriendsHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; friendsHandler = this; } -void FriendsHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - default: - break; - } -} - void FriendsHandler::invite(const std::string &name A_UNUSED) const { } diff --git a/src/net/tmwa/friendshandler.h b/src/net/tmwa/friendshandler.h index 2021352e4..bd223a499 100644 --- a/src/net/tmwa/friendshandler.h +++ b/src/net/tmwa/friendshandler.h @@ -25,20 +25,15 @@ #include "net/friendshandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class FriendsHandler final : public MessageHandler, - public Net::FriendsHandler +class FriendsHandler final : public Net::FriendsHandler { public: FriendsHandler(); A_DELETE_COPY(FriendsHandler) - void handleMessage(Net::MessageIn &msg) override final; - void invite(const std::string &name) const override final; void inviteResponse(const int accountId, diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 00537bf83..7d6d912fa 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -46,54 +46,11 @@ namespace TmwAthena extern ServerInfo mapServer; GameHandler::GameHandler() : - MessageHandler(), Ea::GameHandler() { - static const uint16_t _messages[] = - { - SMSG_MAP_LOGIN_SUCCESS, - SMSG_SERVER_PING, - SMSG_WHO_ANSWER, - SMSG_CHAR_SWITCH_RESPONSE, - SMSG_MAP_QUIT_RESPONSE, - 0 - }; - handledMessages = _messages; gameHandler = this; } -void GameHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("GameHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_MAP_LOGIN_SUCCESS: - GameRecv::processMapLogin(msg); - break; - - case SMSG_SERVER_PING: - // We ignore this for now - // int tick = msg.readInt32() - break; - - case SMSG_WHO_ANSWER: - Ea::GameRecv::processWhoAnswer(msg); - break; - - case SMSG_CHAR_SWITCH_RESPONSE: - Ea::GameRecv::processCharSwitchResponse(msg); - break; - - case SMSG_MAP_QUIT_RESPONSE: - Ea::GameRecv::processMapQuitResponse(msg); - break; - - default: - break; - } - BLOCK_END("GameHandler::handleMessage") -} - void GameHandler::mapLoadedEvent() const { createOutPacket(CMSG_MAP_LOADED); diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h index 9af5d017f..11db03d5c 100644 --- a/src/net/tmwa/gamehandler.h +++ b/src/net/tmwa/gamehandler.h @@ -23,22 +23,18 @@ #ifndef NET_TMWA_GAMEHANDLER_H #define NET_TMWA_GAMEHANDLER_H -#include "net/tmwa/messagehandler.h" - #include "net/ea/gamehandler.h" namespace TmwAthena { -class GameHandler final : public MessageHandler, public Ea::GameHandler +class GameHandler final : public Ea::GameHandler { public: GameHandler(); A_DELETE_COPY(GameHandler) - void handleMessage(Net::MessageIn &msg) override final; - void connect() override final; bool isConnected() const override final A_WARN_UNUSED; diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 5abce494b..b844261d5 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -87,7 +87,6 @@ namespace TmwAthena { GeneralHandler::GeneralHandler() : - MessageHandler(), mAdminHandler(new AdminHandler), mBeingHandler(new BeingHandler(config.getBoolValue("EnableSync"))), mBuySellHandler(new BuySellHandler), @@ -117,7 +116,7 @@ GeneralHandler::GeneralHandler() : mFriendsHandler(new FriendsHandler), mHomunculusHandler(new HomunculusHandler), mMailHandler(new MailHandler), - mMapHandler(new MarketHandler), + mMapHandler(new MapHandler), mMarketHandler(new MarketHandler), mMercenaryHandler(new MercenaryHandler), mRouletteHandler(new RouletteHandler), @@ -127,12 +126,6 @@ GeneralHandler::GeneralHandler() : mServerFeatures(new ServerFeatures) #endif { - static const uint16_t _messages[] = - { - SMSG_CONNECTION_PROBLEM, - 0 - }; - handledMessages = _messages; generalHandler = this; std::vector stats; @@ -157,22 +150,6 @@ GeneralHandler::~GeneralHandler() delete2(Network::mInstance); } -void GeneralHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("GeneralHandler::handleMessage") - - switch (msg.getId()) - { - case SMSG_CONNECTION_PROBLEM: - GeneralRecv::processConnectionProblem(msg); - break; - - default: - break; - } - BLOCK_END("GeneralHandler::handleMessage") -} - void GeneralHandler::load() { new Network; diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index 66aea3869..21bdb5ca0 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -25,15 +25,53 @@ #include "net/generalhandler.h" -#include "net/tmwa/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace TmwAthena { +class AdminHandler; +class BeingHandler; +class BuySellHandler; +class CharServerHandler; +class ChatHandler; +class GameHandler; +class GuildHandler; +class InventoryHandler; +class ItemHandler; +class LoginHandler; +class NpcHandler; +class PartyHandler; +class PetHandler; +class PlayerHandler; +class SkillHandler; +class TradeHandler; +class QuestHandler; +class ServerFeatures; +#ifdef EATHENA_SUPPORT +class AuctionHandler; +class BankHandler; +class BattleGroundHandler; +class BuyingStoreHandler; +class CashShopHandler; +class ElementalHandler; +class FamilyHandler; +class FriendsHandler; +class HomunculusHandler; +class MailHandler; +class MapHandler; +class MarketHandler; +class MercenaryHandler; +class RouletteHandler; +class SearchStoreHandler; +class VendingHandler; +#endif class ServerFeatures; -class GeneralHandler final : public MessageHandler, - public Net::GeneralHandler +class GeneralHandler final : public Net::GeneralHandler { public: GeneralHandler(); @@ -42,8 +80,6 @@ class GeneralHandler final : public MessageHandler, ~GeneralHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void load() override final; void reload() override final; @@ -63,41 +99,41 @@ class GeneralHandler final : public MessageHandler, void gameEnded() const override final; protected: - MessageHandlerPtr mAdminHandler; - MessageHandlerPtr mBeingHandler; - MessageHandlerPtr mBuySellHandler; - MessageHandlerPtr mCharServerHandler; - MessageHandlerPtr mChatHandler; - MessageHandlerPtr mGameHandler; - MessageHandlerPtr mGuildHandler; - MessageHandlerPtr mInventoryHandler; - MessageHandlerPtr mItemHandler; - MessageHandlerPtr mLoginHandler; - MessageHandlerPtr mNpcHandler; - MessageHandlerPtr mPartyHandler; - MessageHandlerPtr mPetHandler; - MessageHandlerPtr mPlayerHandler; - MessageHandlerPtr mSkillHandler; - MessageHandlerPtr mTradeHandler; - MessageHandlerPtr mQuestHandler; + AdminHandler *mAdminHandler; + BeingHandler *mBeingHandler; + BuySellHandler *mBuySellHandler; + CharServerHandler *mCharServerHandler; + ChatHandler *mChatHandler; + GameHandler *mGameHandler; + GuildHandler *mGuildHandler; + InventoryHandler *mInventoryHandler; + ItemHandler *mItemHandler; + LoginHandler *mLoginHandler; + NpcHandler *mNpcHandler; + PartyHandler *mPartyHandler; + PetHandler *mPetHandler; + PlayerHandler *mPlayerHandler; + SkillHandler *mSkillHandler; + TradeHandler *mTradeHandler; + QuestHandler *mQuestHandler; ServerFeatures *mServerFeatures; #ifdef EATHENA_SUPPORT - MessageHandlerPtr mAuctionHandler; - MessageHandlerPtr mBankHandler; - MessageHandlerPtr mBattleGroundHandler; - MessageHandlerPtr mBuyingStoreHandler; - MessageHandlerPtr mCashShopHandler; - MessageHandlerPtr mElementalHandler; - MessageHandlerPtr mFamilyHandler; - MessageHandlerPtr mFriendsHandler; - MessageHandlerPtr mHomunculusHandler; - MessageHandlerPtr mMailHandler; - MessageHandlerPtr mMapHandler; - MessageHandlerPtr mMarketHandler; - MessageHandlerPtr mMercenaryHandler; - MessageHandlerPtr mRouletteHandler; - MessageHandlerPtr mSearchStoreHandler; - MessageHandlerPtr mVendingHandler; + AuctionHandler *mAuctionHandler; + BankHandler *mBankHandler; + BattleGroundHandler *mBattleGroundHandler; + BuyingStoreHandler *mBuyingStoreHandler; + CashShopHandler *mCashShopHandler; + ElementalHandler *mElementalHandler; + FamilyHandler *mFamilyHandler; + FriendsHandler *mFriendsHandler; + HomunculusHandler *mHomunculusHandler; + MailHandler *mMailHandler; + MapHandler *mMapHandler; + MarketHandler *mMarketHandler; + MercenaryHandler *mMercenaryHandler; + RouletteHandler *mRouletteHandler; + SearchStoreHandler *mSearchStoreHandler; + VendingHandler *mVendingHandler; #endif }; diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 957fe2ace..e2074ac27 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -42,41 +42,8 @@ namespace TmwAthena { GuildHandler::GuildHandler() : - Ea::GuildHandler(), - MessageHandler() + Ea::GuildHandler() { - static const uint16_t _messages[] = - { - SMSG_GUILD_CREATE_RESPONSE, - SMSG_GUILD_POSITION_INFO, - SMSG_GUILD_MEMBER_LOGIN, - SMSG_GUILD_MASTER_OR_MEMBER, - SMSG_GUILD_BASIC_INFO, - SMSG_GUILD_ALIANCE_INFO, - SMSG_GUILD_MEMBER_LIST, - SMSG_GUILD_POS_NAME_LIST, - SMSG_GUILD_POS_INFO_LIST, - SMSG_GUILD_POSITION_CHANGED, - SMSG_GUILD_MEMBER_POS_CHANGE, - SMSG_GUILD_EMBLEM_DATA, - SMSG_GUILD_SKILL_INFO, - SMSG_GUILD_NOTICE, - SMSG_GUILD_INVITE, - SMSG_GUILD_INVITE_ACK, - SMSG_GUILD_LEAVE, - SMSG_GUILD_EXPULSION, - SMSG_GUILD_EXPULSION_LIST, - SMSG_GUILD_MESSAGE, - SMSG_GUILD_SKILL_UP, - SMSG_GUILD_REQ_ALLIANCE, - SMSG_GUILD_REQ_ALLIANCE_ACK, - SMSG_GUILD_DEL_ALLIANCE, - SMSG_GUILD_OPPOSITION_ACK, - SMSG_GUILD_BROKEN, - 0 - }; - handledMessages = _messages; - guildHandler = this; } @@ -84,124 +51,6 @@ GuildHandler::~GuildHandler() { } -void GuildHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("GuildHandler::handleMessage") - if (!serverFeatures->haveNativeGuilds()) - return; - - switch (msg.getId()) - { - case SMSG_GUILD_CREATE_RESPONSE: - Ea::GuildRecv::processGuildCreateResponse(msg); - break; - - case SMSG_GUILD_POSITION_INFO: - GuildRecv::processGuildPositionInfo(msg); - break; - - case SMSG_GUILD_MEMBER_LOGIN: - GuildRecv::processGuildMemberLogin(msg); - break; - - case SMSG_GUILD_MASTER_OR_MEMBER: - Ea::GuildRecv::processGuildMasterOrMember(msg); - break; - - case SMSG_GUILD_BASIC_INFO: - Ea::GuildRecv::processGuildBasicInfo(msg); - break; - - case SMSG_GUILD_ALIANCE_INFO: - Ea::GuildRecv::processGuildAlianceInfo(msg); - break; - - case SMSG_GUILD_MEMBER_LIST: - Ea::GuildRecv::processGuildMemberList(msg); - break; - - case SMSG_GUILD_POS_NAME_LIST: - Ea::GuildRecv::processGuildPosNameList(msg); - break; - - case SMSG_GUILD_POS_INFO_LIST: - Ea::GuildRecv::processGuildPosInfoList(msg); - break; - - case SMSG_GUILD_POSITION_CHANGED: - Ea::GuildRecv::processGuildPositionChanged(msg); - break; - - case SMSG_GUILD_MEMBER_POS_CHANGE: - Ea::GuildRecv::processGuildMemberPosChange(msg); - break; - - case SMSG_GUILD_EMBLEM_DATA: - Ea::GuildRecv::processGuildEmblemData(msg); - break; - - case SMSG_GUILD_SKILL_INFO: - Ea::GuildRecv::processGuildSkillInfo(msg); - break; - - case SMSG_GUILD_NOTICE: - Ea::GuildRecv::processGuildNotice(msg); - break; - - case SMSG_GUILD_INVITE: - Ea::GuildRecv::processGuildInvite(msg); - break; - - case SMSG_GUILD_INVITE_ACK: - Ea::GuildRecv::processGuildInviteAck(msg); - break; - - case SMSG_GUILD_LEAVE: - Ea::GuildRecv::processGuildLeave(msg); - break; - - case SMSG_GUILD_EXPULSION: - GuildRecv::processGuildExpulsion(msg); - break; - - case SMSG_GUILD_EXPULSION_LIST: - GuildRecv::processGuildExpulsionList(msg); - break; - - case SMSG_GUILD_MESSAGE: - Ea::GuildRecv::processGuildMessage(msg); - break; - - case SMSG_GUILD_SKILL_UP: - Ea::GuildRecv::processGuildSkillUp(msg); - break; - - case SMSG_GUILD_REQ_ALLIANCE: - Ea::GuildRecv::processGuildReqAlliance(msg); - break; - - case SMSG_GUILD_REQ_ALLIANCE_ACK: - Ea::GuildRecv::processGuildReqAllianceAck(msg); - break; - - case SMSG_GUILD_DEL_ALLIANCE: - Ea::GuildRecv::processGuildDelAlliance(msg); - break; - - case SMSG_GUILD_OPPOSITION_ACK: - Ea::GuildRecv::processGuildOppositionAck(msg); - break; - - case SMSG_GUILD_BROKEN: - Ea::GuildRecv::processGuildBroken(msg); - break; - - default: - break; - } - BLOCK_END("GuildHandler::handleMessage") -} - void GuildHandler::create(const std::string &name) const { createOutPacket(CMSG_GUILD_CREATE); diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index 7bc9e5fef..6b2d0e350 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/guildhandler.h @@ -24,12 +24,10 @@ #include "net/ea/guildhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class GuildHandler final : public Ea::GuildHandler, public MessageHandler +class GuildHandler final : public Ea::GuildHandler { public: GuildHandler(); @@ -38,8 +36,6 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler ~GuildHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void create(const std::string &name) const override final; void invite(const std::string &name) const override final; diff --git a/src/net/tmwa/homunculushandler.cpp b/src/net/tmwa/homunculushandler.cpp index 1a0a89077..7612a5d9f 100644 --- a/src/net/tmwa/homunculushandler.cpp +++ b/src/net/tmwa/homunculushandler.cpp @@ -27,21 +27,11 @@ extern Net::HomunculusHandler *homunculusHandler; namespace TmwAthena { -HomunculusHandler::HomunculusHandler() : - MessageHandler() +HomunculusHandler::HomunculusHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; homunculusHandler = this; } -void HomunculusHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void HomunculusHandler::setName(const std::string &name A_UNUSED) const { } diff --git a/src/net/tmwa/homunculushandler.h b/src/net/tmwa/homunculushandler.h index a54079382..d5997c3f6 100644 --- a/src/net/tmwa/homunculushandler.h +++ b/src/net/tmwa/homunculushandler.h @@ -25,21 +25,16 @@ #include "net/homunculushandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class HomunculusHandler final : public MessageHandler, - public Net::HomunculusHandler +class HomunculusHandler final : public Net::HomunculusHandler { public: HomunculusHandler(); A_DELETE_COPY(HomunculusHandler) - void handleMessage(Net::MessageIn &msg) override final; - void setName(const std::string &name) const override final; void moveToMaster() const override final; diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 950a6b492..33d260673 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -62,30 +62,8 @@ namespace TmwAthena { InventoryHandler::InventoryHandler() : - MessageHandler(), Ea::InventoryHandler() { - static const uint16_t _messages[] = - { - SMSG_PLAYER_INVENTORY, - SMSG_PLAYER_INVENTORY_ADD, - SMSG_PLAYER_INVENTORY_REMOVE, - SMSG_PLAYER_INVENTORY_USE, - SMSG_ITEM_USE_RESPONSE, - SMSG_PLAYER_STORAGE_ITEMS, - SMSG_PLAYER_STORAGE_EQUIP, - SMSG_PLAYER_STORAGE_STATUS, - SMSG_PLAYER_STORAGE_ADD, - SMSG_PLAYER_STORAGE_REMOVE, - SMSG_PLAYER_STORAGE_CLOSE, - SMSG_PLAYER_EQUIPMENT, - SMSG_PLAYER_EQUIP, - SMSG_PLAYER_UNEQUIP, - SMSG_PLAYER_ARROW_EQUIP, - SMSG_PLAYER_ATTACK_RANGE, - 0 - }; - handledMessages = _messages; inventoryHandler = this; } @@ -93,81 +71,6 @@ InventoryHandler::~InventoryHandler() { } -void InventoryHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("InventoryHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_PLAYER_INVENTORY: - InventoryRecv::processPlayerInventory(msg); - break; - - case SMSG_PLAYER_STORAGE_ITEMS: - InventoryRecv::processPlayerStorage(msg); - break; - - case SMSG_PLAYER_STORAGE_EQUIP: - InventoryRecv::processPlayerStorageEquip(msg); - break; - - case SMSG_PLAYER_INVENTORY_ADD: - InventoryRecv::processPlayerInventoryAdd(msg); - break; - - case SMSG_PLAYER_INVENTORY_REMOVE: - Ea::InventoryRecv::processPlayerInventoryRemove(msg); - break; - - case SMSG_PLAYER_INVENTORY_USE: - Ea::InventoryRecv::processPlayerInventoryUse(msg); - break; - - case SMSG_ITEM_USE_RESPONSE: - Ea::InventoryRecv::processItemUseResponse(msg); - break; - - case SMSG_PLAYER_STORAGE_STATUS: - Ea::InventoryRecv::processPlayerStorageStatus(msg); - break; - - case SMSG_PLAYER_STORAGE_ADD: - InventoryRecv::processPlayerStorageAdd(msg); - break; - - case SMSG_PLAYER_STORAGE_REMOVE: - InventoryRecv::processPlayerStorageRemove(msg); - break; - - case SMSG_PLAYER_STORAGE_CLOSE: - Ea::InventoryRecv::processPlayerStorageClose(msg); - break; - - case SMSG_PLAYER_EQUIPMENT: - InventoryRecv::processPlayerEquipment(msg); - break; - - case SMSG_PLAYER_EQUIP: - InventoryRecv::processPlayerEquip(msg); - break; - - case SMSG_PLAYER_UNEQUIP: - InventoryRecv::processPlayerUnEquip(msg); - break; - - case SMSG_PLAYER_ATTACK_RANGE: - Ea::InventoryRecv::processPlayerAttackRange(msg); - break; - - case SMSG_PLAYER_ARROW_EQUIP: - Ea::InventoryRecv::processPlayerArrowEquip(msg); - break; - - default: - break; - } - BLOCK_END("InventoryHandler::handleMessage") -} - void InventoryHandler::equipItem(const Item *const item) const { if (!item) diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index 8bbd17a56..d0ccedab5 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -25,13 +25,10 @@ #include "net/ea/inventoryhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class InventoryHandler final : public MessageHandler, - public Ea::InventoryHandler +class InventoryHandler final : public Ea::InventoryHandler { public: InventoryHandler(); @@ -40,8 +37,6 @@ class InventoryHandler final : public MessageHandler, ~InventoryHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void equipItem(const Item *const item) const override final; void unequipItem(const Item *const item) const override final; diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp index 8bf6239d9..eb42aa2a3 100644 --- a/src/net/tmwa/itemhandler.cpp +++ b/src/net/tmwa/itemhandler.cpp @@ -33,40 +33,8 @@ namespace TmwAthena { ItemHandler::ItemHandler() : - MessageHandler(), Ea::ItemHandler() { - static const uint16_t _messages[] = - { - SMSG_ITEM_VISIBLE, - SMSG_ITEM_DROPPED, - SMSG_ITEM_REMOVE, - 0 - }; - handledMessages = _messages; -} - -void ItemHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("ItemHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_ITEM_VISIBLE: - ItemRecv::processItemVisible(msg); - break; - - case SMSG_ITEM_DROPPED: - ItemRecv::processItemDropped(msg); - break; - - case SMSG_ITEM_REMOVE: - Ea::ItemRecv::processItemRemove(msg); - break; - - default: - break; - } - BLOCK_END("ItemHandler::handleMessage") } } // namespace TmwAthena diff --git a/src/net/tmwa/itemhandler.h b/src/net/tmwa/itemhandler.h index c81eba3c3..0a26a3166 100644 --- a/src/net/tmwa/itemhandler.h +++ b/src/net/tmwa/itemhandler.h @@ -23,21 +23,17 @@ #ifndef NET_TMWA_ITEMHANDLER_H #define NET_TMWA_ITEMHANDLER_H -#include "net/tmwa/messagehandler.h" - #include "net/ea/itemhandler.h" namespace TmwAthena { -class ItemHandler final : public MessageHandler, public Ea::ItemHandler +class ItemHandler final : public Ea::ItemHandler { public: ItemHandler(); A_DELETE_COPY(ItemHandler) - - void handleMessage(Net::MessageIn &msg) override final; }; } // namespace TmwAthena diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 177984d72..de9196814 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -43,19 +43,8 @@ namespace TmwAthena extern ServerInfo charServer; LoginHandler::LoginHandler() : - MessageHandler(), Ea::LoginHandler() { - static const uint16_t _messages[] = - { - SMSG_UPDATE_HOST, - SMSG_LOGIN_DATA, - SMSG_LOGIN_ERROR, - SMSG_CHAR_PASSWORD_RESPONSE, - SMSG_SERVER_VERSION_RESPONSE, - 0 - }; - handledMessages = _messages; loginHandler = this; } @@ -63,37 +52,6 @@ LoginHandler::~LoginHandler() { } -void LoginHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("LoginHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_CHAR_PASSWORD_RESPONSE: - LoginRecv::processCharPasswordResponse(msg); - break; - - case SMSG_UPDATE_HOST: - Ea::LoginRecv::processUpdateHost(msg); - break; - - case SMSG_LOGIN_DATA: - Ea::LoginRecv::processLoginData(msg); - break; - - case SMSG_LOGIN_ERROR: - Ea::LoginRecv::processLoginError(msg); - break; - - case SMSG_SERVER_VERSION_RESPONSE: - LoginRecv::processServerVersion(msg); - break; - - default: - break; - } - BLOCK_END("LoginHandler::handleMessage") -} - void LoginHandler::connect() { if (!Network::mInstance) diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index 48a9e060e..e22e5c2bf 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/loginhandler.h @@ -25,12 +25,10 @@ #include "net/ea/loginhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class LoginHandler final : public MessageHandler, public Ea::LoginHandler +class LoginHandler final : public Ea::LoginHandler { public: LoginHandler(); @@ -39,8 +37,6 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler ~LoginHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void connect() override final; bool isConnected() const override final A_WARN_UNUSED; diff --git a/src/net/tmwa/mailhandler.cpp b/src/net/tmwa/mailhandler.cpp index 911436972..f82f32d72 100644 --- a/src/net/tmwa/mailhandler.cpp +++ b/src/net/tmwa/mailhandler.cpp @@ -27,21 +27,11 @@ extern Net::MailHandler *mailHandler; namespace TmwAthena { -MailHandler::MailHandler() : - MessageHandler() +MailHandler::MailHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; mailHandler = this; } -void MailHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void MailHandler::refresh() const { } diff --git a/src/net/tmwa/mailhandler.h b/src/net/tmwa/mailhandler.h index b6427c763..7278f85c5 100644 --- a/src/net/tmwa/mailhandler.h +++ b/src/net/tmwa/mailhandler.h @@ -25,20 +25,16 @@ #include "net/mailhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class MailHandler final : public MessageHandler, public Net::MailHandler +class MailHandler final : public Net::MailHandler { public: MailHandler(); A_DELETE_COPY(MailHandler) - void handleMessage(Net::MessageIn &msg) override final; - void refresh() const override final; void readMessage(const int msgId) const override final; diff --git a/src/net/tmwa/maphandler.cpp b/src/net/tmwa/maphandler.cpp index 2f2d37a82..6b3262ee5 100644 --- a/src/net/tmwa/maphandler.cpp +++ b/src/net/tmwa/maphandler.cpp @@ -27,19 +27,9 @@ extern Net::MapHandler *mapHandler; namespace TmwAthena { -MapHandler::MapHandler() : - MessageHandler() +MapHandler::MapHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; mapHandler = this; } -void MapHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - } // namespace TmwAthena diff --git a/src/net/tmwa/maphandler.h b/src/net/tmwa/maphandler.h index f532c1bb6..c883dea09 100644 --- a/src/net/tmwa/maphandler.h +++ b/src/net/tmwa/maphandler.h @@ -25,21 +25,15 @@ #include "net/maphandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class MapHandler final : public MessageHandler, public Net::MapHandler +class MapHandler final : public Net::MapHandler { public: MapHandler(); A_DELETE_COPY(MapHandler) - - void handleMessage(Net::MessageIn &msg) override final; - - protected: }; } // namespace TmwAthena diff --git a/src/net/tmwa/markethandler.cpp b/src/net/tmwa/markethandler.cpp index 4e322b1cf..b9dbfa4bb 100644 --- a/src/net/tmwa/markethandler.cpp +++ b/src/net/tmwa/markethandler.cpp @@ -27,26 +27,11 @@ extern Net::MarketHandler *marketHandler; namespace TmwAthena { -MarketHandler::MarketHandler() : - MessageHandler() +MarketHandler::MarketHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; marketHandler = this; } -void MarketHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - default: - break; - } -} - void MarketHandler::close() { } diff --git a/src/net/tmwa/markethandler.h b/src/net/tmwa/markethandler.h index 65d299251..7bbf04aea 100644 --- a/src/net/tmwa/markethandler.h +++ b/src/net/tmwa/markethandler.h @@ -25,20 +25,15 @@ #include "net/markethandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class MarketHandler final : public MessageHandler, - public Net::MarketHandler +class MarketHandler final : public Net::MarketHandler { public: MarketHandler(); A_DELETE_COPY(MarketHandler) - void handleMessage(Net::MessageIn &msg) override final; - void close() override final; void buyItem(const int itemId, diff --git a/src/net/tmwa/mercenaryhandler.cpp b/src/net/tmwa/mercenaryhandler.cpp index 2bbdc0a31..855515e4a 100644 --- a/src/net/tmwa/mercenaryhandler.cpp +++ b/src/net/tmwa/mercenaryhandler.cpp @@ -27,21 +27,11 @@ extern Net::MercenaryHandler *mercenaryHandler; namespace TmwAthena { -MercenaryHandler::MercenaryHandler() : - MessageHandler() +MercenaryHandler::MercenaryHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; mercenaryHandler = this; } -void MercenaryHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void MercenaryHandler::fire() { } diff --git a/src/net/tmwa/mercenaryhandler.h b/src/net/tmwa/mercenaryhandler.h index 17489b7fd..58f119e99 100644 --- a/src/net/tmwa/mercenaryhandler.h +++ b/src/net/tmwa/mercenaryhandler.h @@ -25,21 +25,16 @@ #include "net/mercenaryhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class MercenaryHandler final : public MessageHandler, - public Net::MercenaryHandler +class MercenaryHandler final : public Net::MercenaryHandler { public: MercenaryHandler(); A_DELETE_COPY(MercenaryHandler) - void handleMessage(Net::MessageIn &msg) override final; - void fire() override final; void moveToMaster() const override final; diff --git a/src/net/tmwa/messagehandler.cpp b/src/net/tmwa/messagehandler.cpp deleted file mode 100644 index bc5e2fae7..000000000 --- a/src/net/tmwa/messagehandler.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2015 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "net/tmwa/messagehandler.h" - -#include "net/tmwa/network.h" - -#include - -#include "debug.h" - -namespace TmwAthena -{ - -MessageHandler::MessageHandler() : - Net::MessageHandler() -{ -} - -MessageHandler::~MessageHandler() -{ - if (Network::mInstance) - Network::mInstance->unregisterHandler(this); -} - -void MessageHandler::setNetwork(Network *const network) -{ - assert(!(network && Network::mInstance)); -} - -} // namespace TmwAthena diff --git a/src/net/tmwa/messagehandler.h b/src/net/tmwa/messagehandler.h deleted file mode 100644 index 0ea8609af..000000000 --- a/src/net/tmwa/messagehandler.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2015 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef NET_TMWA_MESSAGEHANDLER_H -#define NET_TMWA_MESSAGEHANDLER_H - -#include "net/messagehandler.h" - -namespace TmwAthena -{ - -class Network; - -/** - * \ingroup Network - */ -class MessageHandler notfinal : public Net::MessageHandler -{ - public: - MessageHandler(); - - A_DELETE_COPY(MessageHandler) - - virtual ~MessageHandler(); - - void setNetwork(Network *const network); -}; - -typedef MessageHandler* MessageHandlerPtr; - -} // namespace TmwAthena - -#endif // NET_TMWA_MESSAGEHANDLER_H diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 0e99f9dbd..069ff373a 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -58,7 +58,6 @@ #include "net/tmwa/skillrecv.h" #include "net/tmwa/traderecv.h" -#include "net/tmwa/messagehandler.h" #include "net/tmwa/messagein.h" #include "net/tmwa/protocol.h" @@ -91,22 +90,6 @@ void Network::registerHandlers() #include "net/tmwa/recvpackets.inc" } -void Network::registerHandler(MessageHandler *const handler) -{ - if (!handler) - return; - - handler->setNetwork(this); -} - -void Network::unregisterHandler(MessageHandler *const handler) -{ - if (!handler) - return; - - handler->setNetwork(nullptr); -} - void Network::clearHandlers() { } diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index 473665576..9e0aa9512 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -34,8 +34,6 @@ namespace TmwAthena { -class MessageHandler; - class Network final : public Ea::Network { public: @@ -45,10 +43,6 @@ class Network final : public Ea::Network ~Network(); - void registerHandler(MessageHandler *const handler); - - void unregisterHandler(MessageHandler *const handler); - void clearHandlers(); bool messageReady(); diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index c3ad53b41..b2e121cef 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -28,12 +28,13 @@ #include "gui/widgets/createwidget.h" -#include "net/ea/npcrecv.h" +#include "net/messagein.h" #include "net/tmwa/messageout.h" #include "net/tmwa/protocol.h" #include "net/ea/eaprotocol.h" +#include "net/ea/npcrecv.h" #include "debug.h" @@ -43,71 +44,11 @@ namespace TmwAthena { NpcHandler::NpcHandler() : - MessageHandler(), Ea::NpcHandler() { - static const uint16_t _messages[] = - { - SMSG_NPC_CHOICE, - SMSG_NPC_MESSAGE, - SMSG_NPC_NEXT, - SMSG_NPC_CLOSE, - SMSG_NPC_INT_INPUT, - SMSG_NPC_STR_INPUT, - SMSG_NPC_COMMAND, - SMSG_NPC_CHANGETITLE, - 0 - }; - handledMessages = _messages; npcHandler = this; } -void NpcHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("NpcHandler::handleMessage") - - switch (msg.getId()) - { - case SMSG_NPC_CHOICE: - Ea::NpcRecv::processNpcChoice(msg); - break; - - case SMSG_NPC_MESSAGE: - Ea::NpcRecv::processNpcMessage(msg); - break; - - case SMSG_NPC_CLOSE: - Ea::NpcRecv::processNpcClose(msg); - break; - - case SMSG_NPC_NEXT: - Ea::NpcRecv::processNpcNext(msg); - break; - - case SMSG_NPC_INT_INPUT: - Ea::NpcRecv::processNpcIntInput(msg); - break; - - case SMSG_NPC_STR_INPUT: - Ea::NpcRecv::processNpcStrInput(msg); - break; - - case SMSG_NPC_COMMAND: - Ea::NpcRecv::processNpcCommand(msg); - break; - - case SMSG_NPC_CHANGETITLE: - Ea::NpcRecv::processChangeTitle(msg); - break; - - default: - break; - } - - Ea::NpcRecv::mDialog = nullptr; - BLOCK_END("NpcHandler::handleMessage") -} - void NpcHandler::talk(const BeingId npcId) const { createOutPacket(CMSG_NPC_TALK); diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h index 35a6f9459..a69845724 100644 --- a/src/net/tmwa/npchandler.h +++ b/src/net/tmwa/npchandler.h @@ -25,20 +25,16 @@ #include "net/ea/npchandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class NpcHandler final : public MessageHandler, public Ea::NpcHandler +class NpcHandler final : public Ea::NpcHandler { public: NpcHandler(); A_DELETE_COPY(NpcHandler) - void handleMessage(Net::MessageIn &msg) override final; - void talk(const BeingId npcId) const override final; void nextDialog(const BeingId npcId) const override final; diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index 46a27b6e9..b20516363 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -43,24 +43,8 @@ namespace TmwAthena { PartyHandler::PartyHandler() : - MessageHandler(), Ea::PartyHandler() { - static const uint16_t _messages[] = - { - SMSG_PARTY_CREATE, - SMSG_PARTY_INFO, - SMSG_PARTY_INVITE_RESPONSE, - SMSG_PARTY_INVITED, - SMSG_PARTY_SETTINGS, - SMSG_PARTY_MOVE, - SMSG_PARTY_LEAVE, - SMSG_PARTY_UPDATE_HP, - SMSG_PARTY_UPDATE_COORDS, - SMSG_PARTY_MESSAGE, - 0 - }; - handledMessages = _messages; partyHandler = this; } @@ -68,48 +52,6 @@ PartyHandler::~PartyHandler() { } -void PartyHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("PartyHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_PARTY_CREATE: - Ea::PartyRecv::processPartyCreate(msg); - break; - case SMSG_PARTY_INFO: - PartyRecv::processPartyInfo(msg); - break; - case SMSG_PARTY_INVITE_RESPONSE: - PartyRecv::processPartyInviteResponse(msg); - break; - case SMSG_PARTY_INVITED: - PartyRecv::processPartyInvited(msg); - break; - case SMSG_PARTY_SETTINGS: - PartyRecv::processPartySettings(msg); - break; - case SMSG_PARTY_MOVE: - PartyRecv::processPartyMove(msg); - break; - case SMSG_PARTY_LEAVE: - Ea::PartyRecv::processPartyLeave(msg); - break; - case SMSG_PARTY_UPDATE_HP: - PartyRecv::processPartyUpdateHp(msg); - break; - case SMSG_PARTY_UPDATE_COORDS: - Ea::PartyRecv::processPartyUpdateCoords(msg); - break; - case SMSG_PARTY_MESSAGE: - PartyRecv::processPartyMessage(msg); - break; - - default: - break; - } - BLOCK_END("PartyHandler::handleMessage") -} - void PartyHandler::create(const std::string &name) const { createOutPacket(CMSG_PARTY_CREATE); diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h index 47fe9c232..5d4ca18ae 100644 --- a/src/net/tmwa/partyhandler.h +++ b/src/net/tmwa/partyhandler.h @@ -22,14 +22,12 @@ #ifndef NET_TMWA_PARTYHANDLER_H #define NET_TMWA_PARTYHANDLER_H -#include "net/tmwa/messagehandler.h" - #include "net/ea/partyhandler.h" namespace TmwAthena { -class PartyHandler final : public MessageHandler, public Ea::PartyHandler +class PartyHandler final : public Ea::PartyHandler { public: PartyHandler(); @@ -38,8 +36,6 @@ class PartyHandler final : public MessageHandler, public Ea::PartyHandler ~PartyHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void create(const std::string &name) const override final; void invite(const std::string &name) const override final; diff --git a/src/net/tmwa/pethandler.cpp b/src/net/tmwa/pethandler.cpp index f759fdb0d..615fbb073 100644 --- a/src/net/tmwa/pethandler.cpp +++ b/src/net/tmwa/pethandler.cpp @@ -35,23 +35,11 @@ namespace TmwAthena { PetHandler::PetHandler() : - MessageHandler(), mRandCounter(1000) { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; petHandler = this; } -void PetHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ - BLOCK_START("PetHandler::handleMessage") - BLOCK_END("PetHandler::handleMessage") -} - void PetHandler::move(const int petId A_UNUSED, const int x, const int y) const { diff --git a/src/net/tmwa/pethandler.h b/src/net/tmwa/pethandler.h index 3a744180a..23428edf8 100644 --- a/src/net/tmwa/pethandler.h +++ b/src/net/tmwa/pethandler.h @@ -21,22 +21,18 @@ #ifndef NET_TMWA_PETHANDLER_H #define NET_TMWA_PETHANDLER_H -#include "net/tmwa/messagehandler.h" - #include "net/pethandler.h" namespace TmwAthena { -class PetHandler final : public MessageHandler, public Net::PetHandler +class PetHandler final : public Net::PetHandler { public: PetHandler(); A_DELETE_COPY(PetHandler) - void handleMessage(Net::MessageIn &msg) override final; - void move(const int petId, const int x, const int y) const override final; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 312a95644..d637aed4d 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -43,79 +43,11 @@ namespace TmwAthena { PlayerHandler::PlayerHandler() : - MessageHandler(), Ea::PlayerHandler() { - static const uint16_t _messages[] = - { - SMSG_WALK_RESPONSE, - SMSG_PLAYER_WARP, - SMSG_PLAYER_STAT_UPDATE_1, - SMSG_PLAYER_STAT_UPDATE_2, - SMSG_PLAYER_STAT_UPDATE_3, - SMSG_PLAYER_STAT_UPDATE_4, - SMSG_PLAYER_STAT_UPDATE_5, - SMSG_PLAYER_STAT_UPDATE_6, - SMSG_PLAYER_ARROW_MESSAGE, - SMSG_MAP_MUSIC, - 0 - }; - handledMessages = _messages; playerHandler = this; } -void PlayerHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("PlayerHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_WALK_RESPONSE: - PlayerRecv::processWalkResponse(msg); - break; - - case SMSG_PLAYER_WARP: - Ea::PlayerRecv::processPlayerWarp(msg); - break; - - case SMSG_PLAYER_STAT_UPDATE_1: - Ea::PlayerRecv::processPlayerStatUpdate1(msg); - break; - - case SMSG_PLAYER_STAT_UPDATE_2: - Ea::PlayerRecv::processPlayerStatUpdate2(msg); - break; - - case SMSG_PLAYER_STAT_UPDATE_3: // Update a base attribute - Ea::PlayerRecv::processPlayerStatUpdate3(msg); - break; - - case SMSG_PLAYER_STAT_UPDATE_4: // Attribute increase ack - Ea::PlayerRecv::processPlayerStatUpdate4(msg); - break; - - // Updates stats and status points - case SMSG_PLAYER_STAT_UPDATE_5: - PlayerRecv::processPlayerStatUpdate5(msg); - break; - - case SMSG_PLAYER_STAT_UPDATE_6: - Ea::PlayerRecv::processPlayerStatUpdate6(msg); - break; - - case SMSG_PLAYER_ARROW_MESSAGE: - Ea::PlayerRecv::processPlayerArrowMessage(msg); - break; - - case SMSG_MAP_MUSIC: - Ea::PlayerRecv::processMapMusic(msg); - break; - - default: - break; - } - BLOCK_END("PlayerHandler::handleMessage") -} - void PlayerHandler::attack(const BeingId id, const Keep keep) const { diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h index 5af3e9676..89dc609c4 100644 --- a/src/net/tmwa/playerhandler.h +++ b/src/net/tmwa/playerhandler.h @@ -25,20 +25,16 @@ #include "net/ea/playerhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler +class PlayerHandler final : public Ea::PlayerHandler { public: PlayerHandler(); A_DELETE_COPY(PlayerHandler) - void handleMessage(Net::MessageIn &msg) override final; - void attack(const BeingId id, const Keep keep) const override final; void stopAttack() const override final; diff --git a/src/net/tmwa/playerrecv.h b/src/net/tmwa/playerrecv.h index 0fcadb104..929591be6 100644 --- a/src/net/tmwa/playerrecv.h +++ b/src/net/tmwa/playerrecv.h @@ -25,8 +25,6 @@ #include "net/ea/playerhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { namespace PlayerRecv diff --git a/src/net/tmwa/questhandler.cpp b/src/net/tmwa/questhandler.cpp index d40603b7f..8ecf0b83e 100644 --- a/src/net/tmwa/questhandler.cpp +++ b/src/net/tmwa/questhandler.cpp @@ -34,38 +34,11 @@ namespace TmwAthena { QuestHandler::QuestHandler() : - MessageHandler(), Net::QuestHandler() { - static const uint16_t _messages[] = - { - SMSG_QUEST_SET_VAR, - SMSG_QUEST_PLAYER_VARS, - 0 - }; - handledMessages = _messages; questHandler = this; } -void QuestHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("QuestHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_QUEST_SET_VAR: - QuestRecv::processSetQuestVar(msg); - break; - - case SMSG_QUEST_PLAYER_VARS: - QuestRecv::processPlayerQuests(msg); - break; - - default: - break; - } - BLOCK_END("QuestHandler::handleMessage") -} - void QuestHandler::setQeustActiveState(const int questId A_UNUSED, const bool active A_UNUSED) const { diff --git a/src/net/tmwa/questhandler.h b/src/net/tmwa/questhandler.h index 920df82fb..60577bf0a 100644 --- a/src/net/tmwa/questhandler.h +++ b/src/net/tmwa/questhandler.h @@ -21,23 +21,18 @@ #ifndef NET_TMWA_QUESTHANDLER_H #define NET_TMWA_QUESTHANDLER_H -#include "net/tmwa/messagehandler.h" - #include "net/questhandler.h" namespace TmwAthena { -class QuestHandler final : public MessageHandler, - public Net::QuestHandler +class QuestHandler final : public Net::QuestHandler { public: QuestHandler(); A_DELETE_COPY(QuestHandler) - void handleMessage(Net::MessageIn &msg) override final; - void setQeustActiveState(const int questId, const bool active) const override final; }; diff --git a/src/net/tmwa/questrecv.cpp b/src/net/tmwa/questrecv.cpp index 51971f1f9..0f05413af 100644 --- a/src/net/tmwa/questrecv.cpp +++ b/src/net/tmwa/questrecv.cpp @@ -23,6 +23,8 @@ #include "gui/windows/skilldialog.h" #include "gui/windows/questswindow.h" +#include "net/messagein.h" + #include "net/tmwa/protocol.h" #include "resources/skillconsts.h" diff --git a/src/net/tmwa/questrecv.h b/src/net/tmwa/questrecv.h index 41d6be3da..f81653cf6 100644 --- a/src/net/tmwa/questrecv.h +++ b/src/net/tmwa/questrecv.h @@ -21,10 +21,13 @@ #ifndef NET_TMWA_QUESTRECV_H #define NET_TMWA_QUESTRECV_H -#include "net/tmwa/messagehandler.h" - #include "net/questhandler.h" +namespace Net +{ + class MessageIn; +} + namespace TmwAthena { namespace QuestRecv diff --git a/src/net/tmwa/roulettehandler.cpp b/src/net/tmwa/roulettehandler.cpp index 63957d926..a3e08ef70 100644 --- a/src/net/tmwa/roulettehandler.cpp +++ b/src/net/tmwa/roulettehandler.cpp @@ -27,24 +27,9 @@ extern Net::RouletteHandler *rouletteHandler; namespace TmwAthena { -RouletteHandler::RouletteHandler() : - MessageHandler() +RouletteHandler::RouletteHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; rouletteHandler = this; } -void RouletteHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - default: - break; - } -} - } // namespace TmwAthena diff --git a/src/net/tmwa/roulettehandler.h b/src/net/tmwa/roulettehandler.h index a16cc269a..981314052 100644 --- a/src/net/tmwa/roulettehandler.h +++ b/src/net/tmwa/roulettehandler.h @@ -25,19 +25,14 @@ #include "net/roulettehandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class RouletteHandler final : public MessageHandler, - public Net::RouletteHandler +class RouletteHandler final : public Net::RouletteHandler { public: RouletteHandler(); A_DELETE_COPY(RouletteHandler) - - void handleMessage(Net::MessageIn &msg) override final; }; } // namespace TmwAthena diff --git a/src/net/tmwa/searchstorehandler.cpp b/src/net/tmwa/searchstorehandler.cpp index 091903e4c..9cea62eb8 100644 --- a/src/net/tmwa/searchstorehandler.cpp +++ b/src/net/tmwa/searchstorehandler.cpp @@ -27,26 +27,11 @@ extern Net::SearchStoreHandler *searchStoreHandler; namespace TmwAthena { -SearchStoreHandler::SearchStoreHandler() : - MessageHandler() +SearchStoreHandler::SearchStoreHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; searchStoreHandler = this; } -void SearchStoreHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - default: - break; - } -} - void SearchStoreHandler::search(const StoreSearchTypeT type A_UNUSED, const int minPrice A_UNUSED, const int maxPrice A_UNUSED, diff --git a/src/net/tmwa/searchstorehandler.h b/src/net/tmwa/searchstorehandler.h index ca1efcd9c..183d1084a 100644 --- a/src/net/tmwa/searchstorehandler.h +++ b/src/net/tmwa/searchstorehandler.h @@ -25,20 +25,15 @@ #include "net/searchstorehandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class SearchStoreHandler final : public MessageHandler, - public Net::SearchStoreHandler +class SearchStoreHandler final : public Net::SearchStoreHandler { public: SearchStoreHandler(); A_DELETE_COPY(SearchStoreHandler) - void handleMessage(Net::MessageIn &msg) override final; - void search(const StoreSearchTypeT type, const int minPrice, const int maxPrice, diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp index 33eb884d1..ed9909e18 100644 --- a/src/net/tmwa/skillhandler.cpp +++ b/src/net/tmwa/skillhandler.cpp @@ -47,43 +47,11 @@ namespace TmwAthena { SkillHandler::SkillHandler() : - MessageHandler(), Ea::SkillHandler() { - static const uint16_t _messages[] = - { - SMSG_PLAYER_SKILLS, - SMSG_SKILL_FAILED, - SMSG_PLAYER_SKILL_UP, - 0 - }; - handledMessages = _messages; skillHandler = this; } -void SkillHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("SkillHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_PLAYER_SKILLS: - SkillRecv::processPlayerSkills(msg); - break; - - case SMSG_PLAYER_SKILL_UP: - Ea::SkillRecv::processPlayerSkillUp(msg); - break; - - case SMSG_SKILL_FAILED: - SkillRecv::processSkillFailed(msg); - break; - - default: - break; - } - BLOCK_END("SkillHandler::handleMessage") -} - void SkillHandler::useBeing(const int id, const int level, const BeingId beingId) const { diff --git a/src/net/tmwa/skillhandler.h b/src/net/tmwa/skillhandler.h index f9e965abd..db5e7c75a 100644 --- a/src/net/tmwa/skillhandler.h +++ b/src/net/tmwa/skillhandler.h @@ -25,20 +25,16 @@ #include "net/ea/skillhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class SkillHandler final : public MessageHandler, public Ea::SkillHandler +class SkillHandler final : public Ea::SkillHandler { public: SkillHandler(); A_DELETE_COPY(SkillHandler) - void handleMessage(Net::MessageIn &msg) override final; - void useBeing(const int id, const int level, const BeingId beingId) const override final; diff --git a/src/net/tmwa/skillrecv.cpp b/src/net/tmwa/skillrecv.cpp index aa7294de2..9c29be38c 100644 --- a/src/net/tmwa/skillrecv.cpp +++ b/src/net/tmwa/skillrecv.cpp @@ -31,6 +31,8 @@ #include "gui/windows/skilldialog.h" +#include "net/messagein.h" + #include "net/ea/skillrecv.h" #include "net/tmwa/messageout.h" diff --git a/src/net/tmwa/skillrecv.h b/src/net/tmwa/skillrecv.h index 65d4f87c5..7d0b84cc2 100644 --- a/src/net/tmwa/skillrecv.h +++ b/src/net/tmwa/skillrecv.h @@ -25,7 +25,10 @@ #include "net/ea/skillhandler.h" -#include "net/tmwa/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace TmwAthena { diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 35a1c06eb..3eccd966d 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -54,64 +54,11 @@ namespace TmwAthena { TradeHandler::TradeHandler() : - MessageHandler(), Ea::TradeHandler() { - static const uint16_t _messages[] = - { - SMSG_TRADE_REQUEST, - SMSG_TRADE_RESPONSE, - SMSG_TRADE_ITEM_ADD, - SMSG_TRADE_ITEM_ADD_RESPONSE, - SMSG_TRADE_OK, - SMSG_TRADE_CANCEL, - SMSG_TRADE_COMPLETE, - 0 - }; - handledMessages = _messages; tradeHandler = this; } - -void TradeHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("TradeHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_TRADE_REQUEST: - TradeRecv::processTradeRequest(msg); - break; - - case SMSG_TRADE_RESPONSE: - TradeRecv::processTradeResponse(msg); - break; - - case SMSG_TRADE_ITEM_ADD: - TradeRecv::processTradeItemAdd(msg); - break; - - case SMSG_TRADE_ITEM_ADD_RESPONSE: - TradeRecv::processTradeItemAddResponse(msg); - break; - - case SMSG_TRADE_OK: - Ea::TradeRecv::processTradeOk(msg); - break; - - case SMSG_TRADE_CANCEL: - Ea::TradeRecv::processTradeCancel(msg); - break; - - case SMSG_TRADE_COMPLETE: - Ea::TradeRecv::processTradeComplete(msg); - break; - - default: - break; - } - BLOCK_END("TradeHandler::handleMessage") -} - void TradeHandler::request(const Being *const being) const { if (!being) diff --git a/src/net/tmwa/tradehandler.h b/src/net/tmwa/tradehandler.h index 125131204..f64b946d2 100644 --- a/src/net/tmwa/tradehandler.h +++ b/src/net/tmwa/tradehandler.h @@ -25,20 +25,16 @@ #include "net/ea/tradehandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class TradeHandler final : public MessageHandler, public Ea::TradeHandler +class TradeHandler final : public Ea::TradeHandler { public: TradeHandler(); A_DELETE_COPY(TradeHandler) - void handleMessage(Net::MessageIn &msg) override final; - void request(const Being *const being) const override final; void respond(const bool accept) const override final; diff --git a/src/net/tmwa/traderecv.cpp b/src/net/tmwa/traderecv.cpp index fce1576cb..654b9eeb5 100644 --- a/src/net/tmwa/traderecv.cpp +++ b/src/net/tmwa/traderecv.cpp @@ -34,13 +34,14 @@ #include "gui/windows/tradewindow.h" +#include "net/messagein.h" + +#include "net/ea/eaprotocol.h" #include "net/ea/traderecv.h" #include "net/tmwa/messageout.h" #include "net/tmwa/protocol.h" -#include "net/ea/eaprotocol.h" - #include "utils/stringutils.h" #include "debug.h" diff --git a/src/net/tmwa/traderecv.h b/src/net/tmwa/traderecv.h index 8702478d7..3b7166267 100644 --- a/src/net/tmwa/traderecv.h +++ b/src/net/tmwa/traderecv.h @@ -25,8 +25,6 @@ #include "net/ea/tradehandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { namespace TradeRecv diff --git a/src/net/tmwa/vendinghandler.cpp b/src/net/tmwa/vendinghandler.cpp index 67e39fd6a..bba591809 100644 --- a/src/net/tmwa/vendinghandler.cpp +++ b/src/net/tmwa/vendinghandler.cpp @@ -27,21 +27,11 @@ extern Net::VendingHandler *vendingHandler; namespace TmwAthena { -VendingHandler::VendingHandler() : - MessageHandler() +VendingHandler::VendingHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; vendingHandler = this; } -void VendingHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void VendingHandler::close() const { } diff --git a/src/net/tmwa/vendinghandler.h b/src/net/tmwa/vendinghandler.h index ddfe72971..36b6031df 100644 --- a/src/net/tmwa/vendinghandler.h +++ b/src/net/tmwa/vendinghandler.h @@ -25,21 +25,16 @@ #include "net/vendinghandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class VendingHandler final : public MessageHandler, - public Net::VendingHandler +class VendingHandler final : public Net::VendingHandler { public: VendingHandler(); A_DELETE_COPY(VendingHandler) - void handleMessage(Net::MessageIn &msg) override final; - void close() const override final; void open(const Being *const being) const override final; -- cgit v1.2.3-70-g09d2