From 7ccc1b5fe8988b2a51d3fb2f4422f95c98a8d6aa Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 2 Sep 2015 02:20:48 +0300 Subject: Use packet handlers from packet defines. --- src/net/eathena/network.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) (limited to 'src/net/eathena/network.cpp') diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index ee85b67d6..fdafd6baf 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -26,6 +26,57 @@ #include "net/packetinfo.h" +#include "net/ea/adminrecv.h" +#include "net/ea/beingrecv.h" +#include "net/ea/buysellrecv.h" +#include "net/ea/charserverrecv.h" +#include "net/ea/chatrecv.h" +#include "net/ea/gamerecv.h" +#include "net/ea/guildrecv.h" +#include "net/ea/inventoryrecv.h" +#include "net/ea/itemrecv.h" +#include "net/ea/loginrecv.h" +#include "net/ea/npcrecv.h" +#include "net/ea/partyrecv.h" +#include "net/ea/playerrecv.h" +#include "net/ea/skillrecv.h" +#include "net/ea/traderecv.h" + +#include "net/eathena/adminrecv.h" +#include "net/eathena/auctionrecv.h" +#include "net/eathena/bankrecv.h" +#include "net/eathena/battlegroundrecv.h" +#include "net/eathena/beingrecv.h" +#include "net/eathena/buyingstorerecv.h" +#include "net/eathena/buysellrecv.h" +#include "net/eathena/cashshoprecv.h" +#include "net/eathena/charserverrecv.h" +#include "net/eathena/chatrecv.h" +#include "net/eathena/elementalrecv.h" +#include "net/eathena/familyrecv.h" +#include "net/eathena/friendsrecv.h" +#include "net/eathena/gamerecv.h" +#include "net/eathena/generalrecv.h" +#include "net/eathena/guildrecv.h" +#include "net/eathena/homunculusrecv.h" +#include "net/eathena/inventoryrecv.h" +#include "net/eathena/itemrecv.h" +#include "net/eathena/loginrecv.h" +#include "net/eathena/mailrecv.h" +#include "net/eathena/maprecv.h" +#include "net/eathena/marketrecv.h" +#include "net/eathena/mercenaryrecv.h" +#include "net/eathena/npcrecv.h" +#include "net/eathena/partyrecv.h" +#include "net/eathena/petrecv.h" +#include "net/eathena/playerrecv.h" +#include "net/eathena/questrecv.h" +#include "net/eathena/rouletterecv.h" +#include "net/eathena/searchstorerecv.h" +#include "net/eathena/skillrecv.h" +#include "net/eathena/traderecv.h" +#include "net/eathena/vendingrecv.h" + #include "net/eathena/messagehandler.h" #include "net/eathena/messagein.h" #include "net/eathena/protocol.h" @@ -120,9 +171,9 @@ void Network::dispatchMessages() if (msgId < messagesSize) { - MessageHandler *const handler = mMessageHandlers[msgId]; - if (handler) - handler->handleMessage(msg); + PacketFuncPtr func = mPackets[msgId].func; + if (func) + func(msg); else logger->log("Unhandled packet: %u 0x%x", msgId, msgId); } -- cgit v1.2.3-70-g09d2