diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-13 21:57:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-13 21:57:12 +0300 |
commit | db1d3323103f15c3d31378b9e94982191855d984 (patch) | |
tree | 85c0aa4c738fceb135d5fe954a7512d22fff1c9f /src/net/eathena/network.cpp | |
parent | 331d1d0989acccf5247d34561d0c962f7a64adc2 (diff) | |
download | manaverse-db1d3323103f15c3d31378b9e94982191855d984.tar.gz manaverse-db1d3323103f15c3d31378b9e94982191855d984.tar.bz2 manaverse-db1d3323103f15c3d31378b9e94982191855d984.tar.xz manaverse-db1d3323103f15c3d31378b9e94982191855d984.zip |
Add fake packets from network.xml if packet unused.
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 ++) |