diff options
Diffstat (limited to 'src')
50 files changed, 127 insertions, 82 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 419a070ad..38e1ba83c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1480,7 +1480,8 @@ SET(SRCS_TMWA net/tmwa/playerhandler.h net/tmwa/playerrecv.cpp net/tmwa/playerrecv.h - net/tmwa/protocol.h + net/tmwa/protocolin.h + net/tmwa/protocolout.h net/tmwa/questhandler.cpp net/tmwa/questhandler.h net/tmwa/questrecv.cpp @@ -1703,7 +1704,8 @@ SET(SRCS_EATHENA net/eathena/playerhandler.h net/eathena/playerrecv.cpp net/eathena/playerrecv.h - net/eathena/protocol.h + net/eathena/protocolin.h + net/eathena/protocolout.h net/eathena/questhandler.cpp net/eathena/questhandler.h net/eathena/questrecv.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 5ba2cd751..8465829ba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1327,7 +1327,8 @@ manaplus_SOURCES += \ net/tmwa/playerhandler.h \ net/tmwa/playerrecv.cpp \ net/tmwa/playerrecv.h \ - net/tmwa/protocol.h \ + net/tmwa/protocolin.h \ + net/tmwa/protocolout.h \ net/tmwa/questhandler.cpp \ net/tmwa/questhandler.h \ net/tmwa/questrecv.cpp \ @@ -1553,7 +1554,8 @@ manaplus_SOURCES += gui/windows/bankwindow.cpp \ net/eathena/playerhandler.h \ net/eathena/playerrecv.cpp \ net/eathena/playerrecv.h \ - net/eathena/protocol.h \ + net/eathena/protocolin.h \ + net/eathena/protocolout.h \ net/eathena/questhandler.cpp \ net/eathena/questhandler.h \ net/eathena/questrecv.cpp \ diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index abb15365f..be909ed24 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -25,7 +25,7 @@ #include "being/being.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/auctionhandler.cpp b/src/net/eathena/auctionhandler.cpp index 742253423..0db4518d0 100644 --- a/src/net/eathena/auctionhandler.cpp +++ b/src/net/eathena/auctionhandler.cpp @@ -25,7 +25,7 @@ #include "net/ea/eaprotocol.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/bankhandler.cpp b/src/net/eathena/bankhandler.cpp index 1ff63fe1f..1c5a35056 100644 --- a/src/net/eathena/bankhandler.cpp +++ b/src/net/eathena/bankhandler.cpp @@ -21,7 +21,7 @@ #include "net/eathena/bankhandler.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/battlegroundhandler.cpp b/src/net/eathena/battlegroundhandler.cpp index 544f51f76..22f3accda 100644 --- a/src/net/eathena/battlegroundhandler.cpp +++ b/src/net/eathena/battlegroundhandler.cpp @@ -21,7 +21,7 @@ #include "net/eathena/battlegroundhandler.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 683f5ec0d..ddee2d6fa 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -23,7 +23,7 @@ #include "net/eathena/beinghandler.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "net/eathena/sprite.h" #include "debug.h" diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp index e59954968..27743db7b 100644 --- a/src/net/eathena/buyingstorehandler.cpp +++ b/src/net/eathena/buyingstorehandler.cpp @@ -28,7 +28,7 @@ #include "net/ea/eaprotocol.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp index 7de9b1bdb..eac9f994f 100644 --- a/src/net/eathena/buysellhandler.cpp +++ b/src/net/eathena/buysellhandler.cpp @@ -25,7 +25,7 @@ #include "net/ea/buysellrecv.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/cashshophandler.cpp b/src/net/eathena/cashshophandler.cpp index 058dedfdc..5bb54b119 100644 --- a/src/net/eathena/cashshophandler.cpp +++ b/src/net/eathena/cashshophandler.cpp @@ -22,7 +22,7 @@ #include "net/eathena/cashshoprecv.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 4a0010529..0b6ffa1bb 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -33,7 +33,7 @@ #include "net/eathena/loginhandler.h" #include "net/eathena/messageout.h" #include "net/eathena/network.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp index 62be4a694..1939749b0 100644 --- a/src/net/eathena/charserverrecv.cpp +++ b/src/net/eathena/charserverrecv.cpp @@ -42,7 +42,7 @@ #include "net/eathena/loginhandler.h" #include "net/eathena/messageout.h" #include "net/eathena/network.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "net/eathena/sprite.h" #include "resources/iteminfo.h" diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 2721bb3fb..c3f8bf039 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -30,7 +30,7 @@ #include "net/eathena/chatrecv.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "resources/chatobject.h" diff --git a/src/net/eathena/familyhandler.cpp b/src/net/eathena/familyhandler.cpp index 37c6cd079..b91758a40 100644 --- a/src/net/eathena/familyhandler.cpp +++ b/src/net/eathena/familyhandler.cpp @@ -24,7 +24,7 @@ #include "net/eathena/familyrecv.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/friendshandler.cpp b/src/net/eathena/friendshandler.cpp index 1e13b196e..873618b2b 100644 --- a/src/net/eathena/friendshandler.cpp +++ b/src/net/eathena/friendshandler.cpp @@ -21,7 +21,7 @@ #include "net/eathena/friendshandler.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp index 9c23c1435..1b5b1bc3a 100644 --- a/src/net/eathena/gamehandler.cpp +++ b/src/net/eathena/gamehandler.cpp @@ -35,7 +35,7 @@ #include "net/eathena/loginhandler.h" #include "net/eathena/messageout.h" #include "net/eathena/network.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index 98adedbc4..4f0f4f483 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -29,7 +29,7 @@ #include "net/ea/guildrecv.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp index 359b0a856..a2806d6e4 100644 --- a/src/net/eathena/homunculushandler.cpp +++ b/src/net/eathena/homunculushandler.cpp @@ -25,7 +25,7 @@ #include "net/serverfeatures.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index dd5c655b3..1b781c3be 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -29,7 +29,7 @@ #include "net/eathena/inventoryrecv.h" #include "net/eathena/menu.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "net/ea/eaprotocol.h" diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp index 52435cf24..71bf67245 100644 --- a/src/net/eathena/loginhandler.cpp +++ b/src/net/eathena/loginhandler.cpp @@ -29,7 +29,7 @@ #include "net/eathena/messageout.h" #include "net/eathena/network.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/mailhandler.cpp b/src/net/eathena/mailhandler.cpp index 8ab0fc9d8..013ac9107 100644 --- a/src/net/eathena/mailhandler.cpp +++ b/src/net/eathena/mailhandler.cpp @@ -23,7 +23,7 @@ #include "net/ea/eaprotocol.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/markethandler.cpp b/src/net/eathena/markethandler.cpp index 5c71b3032..b96e5b588 100644 --- a/src/net/eathena/markethandler.cpp +++ b/src/net/eathena/markethandler.cpp @@ -22,7 +22,7 @@ #include "net/eathena/marketrecv.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp index a7b9c957c..227626304 100644 --- a/src/net/eathena/mercenaryhandler.cpp +++ b/src/net/eathena/mercenaryhandler.cpp @@ -25,7 +25,7 @@ #include "net/serverfeatures.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index 00afb763b..74474b08f 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -34,7 +34,8 @@ #include "net/ea/npcrecv.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolin.h" +#include "net/eathena/protocolout.h" #include "debug.h" @@ -197,6 +198,7 @@ void NpcHandler::selectAutoSpell(const int skillId) const BeingId NpcHandler::getNpc(Net::MessageIn &msg) { + // +++ must be removed SMSG_* if (msg.getId() == SMSG_NPC_CHOICE || msg.getId() == SMSG_NPC_MESSAGE || msg.getId() == SMSG_NPC_CHANGETITLE) @@ -209,11 +211,13 @@ BeingId NpcHandler::getNpc(Net::MessageIn &msg) const NpcDialogs::const_iterator diag = NpcDialog::mNpcDialogs.find(npcId); Ea::NpcRecv::mDialog = nullptr; + // +++ must be removed SMSG_* if (msg.getId() == SMSG_NPC_VIEWPOINT) return npcId; if (diag == NpcDialog::mNpcDialogs.end()) { + // +++ must be removed SMSG_* // Empty dialogs don't help if (msg.getId() == SMSG_NPC_CLOSE) { diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp index 18c0c3517..3aaefe7ce 100644 --- a/src/net/eathena/partyhandler.cpp +++ b/src/net/eathena/partyhandler.cpp @@ -32,7 +32,7 @@ #include "net/ea/partyrecv.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp index 8a005d265..7ebc11a9e 100644 --- a/src/net/eathena/pethandler.cpp +++ b/src/net/eathena/pethandler.cpp @@ -25,7 +25,7 @@ #include "net/serverfeatures.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 28fa63a27..59184c415 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -25,7 +25,7 @@ #include "being/playerinfo.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "net/eathena/inventoryhandler.h" #include "debug.h" diff --git a/src/net/eathena/protocolin.h b/src/net/eathena/protocolin.h new file mode 100644 index 000000000..7c2f7d4c8 --- /dev/null +++ b/src/net/eathena/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_EATHENA_PROTOCOLIN_H +#define NET_EATHENA_PROTOCOLIN_H + +#include "net/protocolindefine.h" +#include "net/eathena/packetsin.inc" +#undef packet + +#endif // NET_EATHENA_PROTOCOLIN_H diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocolout.h index ddf3f08fd..13376bcfb 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/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_EATHENA_PROTOCOL_H -#define NET_EATHENA_PROTOCOL_H - -#include "net/protocolindefine.h" -#include "net/eathena/packetsin.inc" -#undef packet +#ifndef NET_EATHENA_PROTOCOLOUT_H +#define NET_EATHENA_PROTOCOLOUT_H #include "net/protocoloutdefine.h" #include "net/eathena/packetsout.inc" #undef packet -#endif // NET_EATHENA_PROTOCOL_H +#endif // NET_EATHENA_PROTOCOLOUT_H diff --git a/src/net/eathena/questhandler.cpp b/src/net/eathena/questhandler.cpp index f1c77aa1a..d6d36e5eb 100644 --- a/src/net/eathena/questhandler.cpp +++ b/src/net/eathena/questhandler.cpp @@ -21,7 +21,7 @@ #include "net/eathena/questhandler.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/searchstorehandler.cpp b/src/net/eathena/searchstorehandler.cpp index 871807f62..fcea736aa 100644 --- a/src/net/eathena/searchstorehandler.cpp +++ b/src/net/eathena/searchstorehandler.cpp @@ -21,7 +21,7 @@ #include "net/eathena/searchstorehandler.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index 82eab62c7..edf8ebbc5 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -23,7 +23,7 @@ #include "net/eathena/skillhandler.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "debug.h" diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp index 8a59b6739..99c670437 100644 --- a/src/net/eathena/tradehandler.cpp +++ b/src/net/eathena/tradehandler.cpp @@ -27,7 +27,7 @@ #include "being/playerinfo.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "net/eathena/traderecv.h" #include "net/ea/eaprotocol.h" diff --git a/src/net/eathena/vendinghandler.cpp b/src/net/eathena/vendinghandler.cpp index f56ad677c..fed7b66ca 100644 --- a/src/net/eathena/vendinghandler.cpp +++ b/src/net/eathena/vendinghandler.cpp @@ -28,7 +28,7 @@ #include "net/ea/eaprotocol.h" #include "net/eathena/messageout.h" -#include "net/eathena/protocol.h" +#include "net/eathena/protocolout.h" #include "net/eathena/vendingrecv.h" #include "debug.h" 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" |