summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-13 23:15:31 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-13 23:15:31 +0300
commit0fc8851faef219be6a3e161946fd6a09930efeb0 (patch)
tree10e6af31050715ad1267fe87cd00b81bcb0eb2f3 /src/net
parentdb1d3323103f15c3d31378b9e94982191855d984 (diff)
downloadplus-0fc8851faef219be6a3e161946fd6a09930efeb0.tar.gz
plus-0fc8851faef219be6a3e161946fd6a09930efeb0.tar.bz2
plus-0fc8851faef219be6a3e161946fd6a09930efeb0.tar.xz
plus-0fc8851faef219be6a3e161946fd6a09930efeb0.zip
Add support for removepacket tag in network.xml
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/network.cpp28
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()