diff options
Diffstat (limited to 'src/net/eathena/network.cpp')
-rw-r--r-- | src/net/eathena/network.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 21736333c..74f3c3e00 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -80,6 +80,10 @@ #include "net/eathena/messagein.h" +#include "resources/db/networkdb.h" + +#include "utils/checkutils.h" + #include "debug.h" extern int packetVersion; @@ -111,6 +115,34 @@ void Network::registerHandlers() RECVPACKETS_VOID } +void Network::registerFakeHandlers() +{ + const NetworkInfos &packets = NetworkDb::getFakePackets(); + FOR_EACH (NetworkInfosIter, it, packets) + { + const size_t id = (*it).first; + if (id >= packet_lengths_size) + { + reportAlways("Wrong fake packet id %d", CAST_S32(id)); + continue; + } + if (mPackets[id].len != 0 || + mPackets[id].func != nullptr || + mPackets[id].version != 0) + { + continue; + } + const int32_t len = (*it).second; + logger->log("Add fake packet: %d, %d", + CAST_S32(id), + len); + mPackets[id].name = "fake"; + mPackets[id].len = len; + mPackets[id].func = nullptr; + mPackets[id].version = 0; + } +} + void Network::clearHandlers() { for (size_t f = 0; f < packet_lengths_size; f ++) |