From 53eede04dc83830481fa0981f47339e2c8072b42 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 1 Sep 2015 23:08:32 +0300 Subject: Use packet sizes from packetsin.inc --- src/net/eathena/network.cpp | 16 +++++----------- src/net/eathena/packetsin.inc | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src/net/eathena') diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index ed6f6f1f7..75a737ad2 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -38,8 +38,7 @@ namespace EAthena { -static const unsigned int packet_lengths_size - = static_cast(sizeof(packet_lengths) / sizeof(int16_t)); +static const unsigned int packet_lengths_size = 0xFFFFU; static const unsigned int messagesSize = 0xFFFFU; Network *Network::mInstance = nullptr; @@ -103,8 +102,7 @@ void Network::dispatchMessages() const unsigned int msgId = readWord(0); int len = -1; if (msgId < packet_lengths_size) - len = packet_lengths[msgId]; - + len = mPackets[msgId].len; if (len == -1) len = readWord(2); @@ -144,14 +142,10 @@ bool Network::messageReady() if (mInSize >= 2) { const int msgId = readWord(0); - if (msgId == SMSG_SERVER_VERSION_RESPONSE) - { - len = 10; - } - else if (msgId >= 0 && static_cast(msgId) - < packet_lengths_size) + if (msgId >= 0 && + static_cast(msgId) < packet_lengths_size) { - len = packet_lengths[msgId]; + len = mPackets[msgId].len; } if (len == -1 && mInSize > 4) diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index fc90d90e0..54f1ad2b9 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -381,7 +381,7 @@ packet(SMSG_SEARCHSTORE_OPEN, 0x083a, 5); packet(SMSG_SEARCHSTORE_SEARCH_ACK, 0x0836, 0); packet(SMSG_SEARCHSTORE_SEARCH_FAILED, 0x0837, 0); packet(SMSG_SERVER_PING, 0x007f, 6); -packet(SMSG_SERVER_VERSION_RESPONSE, 0x7531, 10); +packet(SMSG_SERVER_VERSION_RESPONSE, 0x7531, -1); packet(SMSG_SKILL_ARROW_CREATE_LIST, 0x01ad, -1); packet(SMSG_SKILL_AUTO_CAST, 0x0147, 39); packet(SMSG_SKILL_CASTING, 0x07fb, 25); -- cgit v1.2.3-70-g09d2