diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-13 23:15:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-13 23:15:31 +0300 |
commit | 0fc8851faef219be6a3e161946fd6a09930efeb0 (patch) | |
tree | 10e6af31050715ad1267fe87cd00b81bcb0eb2f3 /src/net/eathena/network.cpp | |
parent | db1d3323103f15c3d31378b9e94982191855d984 (diff) | |
download | manaverse-0fc8851faef219be6a3e161946fd6a09930efeb0.tar.gz manaverse-0fc8851faef219be6a3e161946fd6a09930efeb0.tar.bz2 manaverse-0fc8851faef219be6a3e161946fd6a09930efeb0.tar.xz manaverse-0fc8851faef219be6a3e161946fd6a09930efeb0.zip |
Add support for removepacket tag in network.xml
Diffstat (limited to 'src/net/eathena/network.cpp')
-rw-r--r-- | src/net/eathena/network.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 74f3c3e00..973d306f9 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -117,8 +117,8 @@ void Network::registerHandlers() void Network::registerFakeHandlers() { - const NetworkInfos &packets = NetworkDb::getFakePackets(); - FOR_EACH (NetworkInfosIter, it, packets) + const NetworkInPacketInfos &packets = NetworkDb::getFakePackets(); + FOR_EACH (NetworkInPacketInfosIter, it, packets) { const size_t id = (*it).first; if (id >= packet_lengths_size) @@ -141,6 +141,30 @@ void Network::registerFakeHandlers() mPackets[id].func = nullptr; mPackets[id].version = 0; } + + const NetworkRemovePacketInfos &removePackets = + NetworkDb::getRemovePackets(); + FOR_EACH (NetworkRemovePacketInfosIter, it, removePackets) + { + const size_t id = *it; + if (id >= packet_lengths_size) + { + reportAlways("Wrong remove packet id %d", CAST_S32(id)); + continue; + } + if (mPackets[id].len == 0 && + mPackets[id].func == nullptr && + mPackets[id].version == 0) + { + continue; + } + logger->log("Remove packet: %d", + CAST_S32(id)); + mPackets[id].name = ""; + mPackets[id].len = 0; + mPackets[id].func = nullptr; + mPackets[id].version = 0; + } } void Network::clearHandlers() |