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/tmwa/network.cpp | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 0e97cbe46..cce906703 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -26,6 +26,38 @@ #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/tmwa/beingrecv.h" +#include "net/tmwa/buysellrecv.h" +#include "net/tmwa/charserverrecv.h" +#include "net/tmwa/chatrecv.h" +#include "net/tmwa/gamerecv.h" +#include "net/tmwa/generalrecv.h" +#include "net/tmwa/guildrecv.h" +#include "net/tmwa/inventoryrecv.h" +#include "net/tmwa/itemrecv.h" +#include "net/tmwa/loginrecv.h" +#include "net/tmwa/partyrecv.h" +#include "net/tmwa/playerrecv.h" +#include "net/tmwa/questrecv.h" +#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" @@ -127,9 +159,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