summaryrefslogtreecommitdiff
path: root/src/net/eathena/network.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-01 23:08:32 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-01 23:16:32 +0300
commit53eede04dc83830481fa0981f47339e2c8072b42 (patch)
treec84798a327ee988afb9239cf27781ca538d18250 /src/net/eathena/network.cpp
parent83915bb5c10c8b694e633b8e3089603d3281b8a0 (diff)
downloadManaVerse-53eede04dc83830481fa0981f47339e2c8072b42.tar.gz
ManaVerse-53eede04dc83830481fa0981f47339e2c8072b42.tar.bz2
ManaVerse-53eede04dc83830481fa0981f47339e2c8072b42.tar.xz
ManaVerse-53eede04dc83830481fa0981f47339e2c8072b42.zip
Use packet sizes from packetsin.inc
Diffstat (limited to 'src/net/eathena/network.cpp')
-rw-r--r--src/net/eathena/network.cpp16
1 files changed, 5 insertions, 11 deletions
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<unsigned int>(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<unsigned int>(msgId)
- < packet_lengths_size)
+ if (msgId >= 0 &&
+ static_cast<unsigned int>(msgId) < packet_lengths_size)
{
- len = packet_lengths[msgId];
+ len = mPackets[msgId].len;
}
if (len == -1 && mInSize > 4)