diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-07 19:26:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-07 19:26:12 +0300 |
commit | 6e2a02c73e54648c7eefe2cb8cfc99a285fed868 (patch) | |
tree | 6f5a47590d861bbbb8065a203de054b1f9503303 /src/net/tmwa | |
parent | e06101a4c8633a43d813d4a62bde2d9f49c128bf (diff) | |
download | manaplus-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')
-rw-r--r-- | src/net/tmwa/adminhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/gamehandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/guildhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 20 | ||||
-rw-r--r-- | src/net/tmwa/npchandler.cpp | 5 | ||||
-rw-r--r-- | src/net/tmwa/partyhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/protocolin.h | 28 | ||||
-rw-r--r-- | src/net/tmwa/protocolout.h (renamed from src/net/tmwa/protocol.h) | 14 | ||||
-rw-r--r-- | src/net/tmwa/skillhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/tradehandler.cpp | 2 |
16 files changed, 53 insertions, 38 deletions
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index fe2151df0..b5d032e72 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -27,7 +27,7 @@ #include "net/chathandler.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "utils/stringutils.h" diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index fd334b712..2cbd41835 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -23,7 +23,7 @@ #include "net/tmwa/beinghandler.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "net/tmwa/sprite.h" #include "debug.h" diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 76e428156..6b2dbedba 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -33,7 +33,7 @@ #include "net/tmwa/loginhandler.h" #include "net/tmwa/messageout.h" #include "net/tmwa/network.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "resources/db/chardb.h" diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 5ec871685..165d91422 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -31,7 +31,7 @@ #include "net/ea/chatrecv.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "utils/stringutils.h" diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 8e1c8970d..7a8628df5 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -33,7 +33,7 @@ #include "net/tmwa/loginhandler.h" #include "net/tmwa/messageout.h" #include "net/tmwa/network.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "debug.h" diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 3494c87bb..cf6443683 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -29,7 +29,7 @@ #include "net/ea/guildrecv.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "debug.h" diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 2cca7ebc3..3248ec8f6 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -27,7 +27,7 @@ #include "enums/equipslot.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "net/ea/eaprotocol.h" diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index c2cf125d4..d45cd7a09 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -30,7 +30,7 @@ #include "net/tmwa/messageout.h" #include "net/tmwa/network.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "debug.h" 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) diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index b2e121cef..351cb2d7a 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -31,7 +31,8 @@ #include "net/messagein.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolin.h" +#include "net/tmwa/protocolout.h" #include "net/ea/eaprotocol.h" #include "net/ea/npcrecv.h" @@ -181,6 +182,7 @@ void NpcHandler::selectAutoSpell(const int skillId A_UNUSED) const BeingId NpcHandler::getNpc(Net::MessageIn &msg) { + // +++ must be removed packet id checks from here if (msg.getId() == SMSG_NPC_CHOICE || msg.getId() == SMSG_NPC_MESSAGE || msg.getId() == SMSG_NPC_CHANGETITLE) @@ -195,6 +197,7 @@ BeingId NpcHandler::getNpc(Net::MessageIn &msg) if (diag == NpcDialog::mNpcDialogs.end()) { + // +++ must be removed packet id checks from here // Empty dialogs don't help if (msg.getId() == SMSG_NPC_CLOSE) { diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index 6c721ffd1..e8c39f677 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -32,7 +32,7 @@ #include "net/ea/partyrecv.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "debug.h" diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 5591c903e..d4adfec57 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -27,7 +27,7 @@ #include "net/tmwa/inventoryhandler.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "debug.h" diff --git a/src/net/tmwa/protocolin.h b/src/net/tmwa/protocolin.h new file mode 100644 index 000000000..5e2225991 --- /dev/null +++ b/src/net/tmwa/protocolin.h @@ -0,0 +1,28 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef NET_TMWA_PROTOCOLIN_H +#define NET_TMWA_PROTOCOLIN_H + +#include "net/protocolindefine.h" +#include "net/tmwa/packetsin.inc" +#undef packet + +#endif // NET_TMWA_PROTOCOLIN_H diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocolout.h index 43eff2c85..d1e4430cb 100644 --- a/src/net/tmwa/protocol.h +++ b/src/net/tmwa/protocolout.h @@ -1,8 +1,6 @@ /* * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2015 The ManaPlus Developers + * Copyright (C) 2015 The ManaPlus Developers * * This file is part of The ManaPlus Client. * @@ -20,15 +18,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef NET_TMWA_PROTOCOL_H -#define NET_TMWA_PROTOCOL_H - -#include "net/protocolindefine.h" -#include "net/tmwa/packetsin.inc" -#undef packet +#ifndef NET_TMWA_PROTOCOLOUT_H +#define NET_TMWA_PROTOCOLOUT_H #include "net/protocoloutdefine.h" #include "net/tmwa/packetsout.inc" #undef packet -#endif // NET_TMWA_PROTOCOL_H +#endif // NET_TMWA_PROTOCOLOUT_H diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp index a666dec96..6442e8d8e 100644 --- a/src/net/tmwa/skillhandler.cpp +++ b/src/net/tmwa/skillhandler.cpp @@ -23,7 +23,7 @@ #include "net/tmwa/skillhandler.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "debug.h" diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 1d889b1db..14e407bb9 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -27,7 +27,7 @@ #include "being/playerinfo.h" #include "net/tmwa/messageout.h" -#include "net/tmwa/protocol.h" +#include "net/tmwa/protocolout.h" #include "net/ea/eaprotocol.h" |