summaryrefslogtreecommitdiff
path: root/src/net/tmwa/network.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-07 19:26:12 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-07 19:26:12 +0300
commit6e2a02c73e54648c7eefe2cb8cfc99a285fed868 (patch)
tree6f5a47590d861bbbb8065a203de054b1f9503303 /src/net/tmwa/network.cpp
parente06101a4c8633a43d813d4a62bde2d9f49c128bf (diff)
downloadmanaplus-6e2a02c73e54648c7eefe2cb8cfc99a285fed868.tar.gz
manaplus-6e2a02c73e54648c7eefe2cb8cfc99a285fed868.tar.bz2
manaplus-6e2a02c73e54648c7eefe2cb8cfc99a285fed868.tar.xz
manaplus-6e2a02c73e54648c7eefe2cb8cfc99a285fed868.zip
Split protocol.h into protocolin.h and protocolout.h
Diffstat (limited to 'src/net/tmwa/network.cpp')
-rw-r--r--src/net/tmwa/network.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 16f4c073f..28cfce499 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -59,14 +59,13 @@
#include "net/tmwa/traderecv.h"
#include "net/tmwa/messagein.h"
-#include "net/tmwa/protocol.h"
#include "debug.h"
namespace TmwAthena
{
-static const unsigned int packet_lengths_size = 0x0230U;
+static const unsigned int packet_lengths_size = 0xFFFFU;
static const unsigned int messagesSize = 0xFFFFU;
Network *Network::mInstance = nullptr;
@@ -102,9 +101,7 @@ void Network::dispatchMessages()
BLOCK_START("Network::dispatchMessages 2")
const unsigned int msgId = readWord(0);
int len = -1;
- if (msgId == SMSG_SERVER_VERSION_RESPONSE)
- len = 10;
- else if (msgId < packet_lengths_size)
+ if (msgId < packet_lengths_size)
len = mPackets[msgId].len;
if (len == -1)
@@ -153,17 +150,10 @@ bool Network::messageReady()
if (mInSize >= 2)
{
const int msgId = readWord(0);
- if (msgId == SMSG_SERVER_VERSION_RESPONSE)
+ if (msgId >= 0 && static_cast<unsigned int>(msgId)
+ < packet_lengths_size)
{
- len = 10;
- }
- else
- {
- if (msgId >= 0 && static_cast<unsigned int>(msgId)
- < packet_lengths_size)
- {
- len = mPackets[msgId].len;
- }
+ len = mPackets[msgId].len;
}
if (len == -1 && mInSize > 4)