diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-14 16:54:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-14 16:54:21 +0300 |
commit | 4af398b58583dd834090f51b70adc749cd082cbb (patch) | |
tree | b11ebd7bb9e9aae0eaded8b53e35ab22154a0746 /src/net | |
parent | f42895110758580885e52c6dffbb9e090c9ee101 (diff) | |
download | plus-4af398b58583dd834090f51b70adc749cd082cbb.tar.gz plus-4af398b58583dd834090f51b70adc749cd082cbb.tar.bz2 plus-4af398b58583dd834090f51b70adc749cd082cbb.tar.xz plus-4af398b58583dd834090f51b70adc749cd082cbb.zip |
Add into tmwa packet SMSG_MAP_SET_TILES_TYPE. Change protocol version to 7.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/maprecv.cpp | 58 | ||||
-rw-r--r-- | src/net/ea/maprecv.h | 40 | ||||
-rw-r--r-- | src/net/eathena/maprecv.cpp | 27 | ||||
-rw-r--r-- | src/net/eathena/maprecv.h | 1 | ||||
-rw-r--r-- | src/net/eathena/network.cpp | 1 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 1 | ||||
-rw-r--r-- | src/net/tmwa/network.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/packetsin.inc | 1 |
9 files changed, 104 insertions, 29 deletions
diff --git a/src/net/ea/maprecv.cpp b/src/net/ea/maprecv.cpp new file mode 100644 index 000000000..a42af3e9b --- /dev/null +++ b/src/net/ea/maprecv.cpp @@ -0,0 +1,58 @@ +/* + * The ManaPlus Client + * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net> + * Copyright (C) 2011-2016 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/>. + */ + +#include "net/ea/maprecv.h" + +#include "gui/viewport.h" + +#include "resources/map/map.h" + +#include "net/messagein.h" + +#include "debug.h" + +namespace Ea +{ + +void MapRecv::processSetTilesType(Net::MessageIn &msg) +{ + const int x1 = msg.readInt16("x1"); + const int y1 = msg.readInt16("y1"); + const int x2 = msg.readInt16("x2"); + const int y2 = msg.readInt16("y2"); + const BlockTypeT mask = static_cast<BlockTypeT>(msg.readInt32("mask")); + const int layer = msg.readInt32("layer"); + const std::string name = msg.readString(16, "map name"); + if (layer) + return; + Map *const map = viewport->getMap(); + if (map && map->getGatName() == name) + { + for (int y = y1; y <= y2; y ++) + { + for (int x = x1; x <= x2; x ++) + map->setBlockMask(x, y, mask); + } + map->updateConditionLayers(); + } +} + +} // namespace Ea diff --git a/src/net/ea/maprecv.h b/src/net/ea/maprecv.h new file mode 100644 index 000000000..b62a063d8 --- /dev/null +++ b/src/net/ea/maprecv.h @@ -0,0 +1,40 @@ +/* + * The ManaPlus Client + * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net> + * Copyright (C) 2011-2016 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_EA_MAPRECV_H +#define NET_EA_MAPRECV_H + +#include "localconsts.h" + +namespace Net +{ + class MessageIn; +} // namespace Net + +namespace Ea +{ + namespace MapRecv + { + void processSetTilesType(Net::MessageIn &msg); + } // namespace PartyRecv +} // namespace Ea + +#endif // NET_EA_MAPRECV_H diff --git a/src/net/eathena/maprecv.cpp b/src/net/eathena/maprecv.cpp index 44afba62d..dc72c65cd 100644 --- a/src/net/eathena/maprecv.cpp +++ b/src/net/eathena/maprecv.cpp @@ -20,12 +20,10 @@ #include "net/eathena/maprecv.h" -#include "gui/viewport.h" +#include "logger.h" #include "net/messagein.h" -#include "resources/map/map.h" - #include "debug.h" namespace EAthena @@ -59,29 +57,6 @@ void MapRecv::processInstanceDelete(Net::MessageIn &msg) msg.readInt32("unused"); } -void MapRecv::processSetTilesType(Net::MessageIn &msg) -{ - const int x1 = msg.readInt16("x1"); - const int y1 = msg.readInt16("y1"); - const int x2 = msg.readInt16("x2"); - const int y2 = msg.readInt16("y2"); - const BlockTypeT mask = static_cast<BlockTypeT>(msg.readInt32("mask")); - const int layer = msg.readInt32("layer"); - const std::string name = msg.readString(16, "map name"); - if (layer) - return; - Map *const map = viewport->getMap(); - if (map && map->getGatName() == name) - { - for (int y = y1; y <= y2; y ++) - { - for (int x = x1; x <= x2; x ++) - map->setBlockMask(x, y, mask); - } - map->updateConditionLayers(); - } -} - void MapRecv::processAddMapMarker(Net::MessageIn &msg) { UNIMPLIMENTEDPACKET; diff --git a/src/net/eathena/maprecv.h b/src/net/eathena/maprecv.h index 4fd740c75..31bcb6129 100644 --- a/src/net/eathena/maprecv.h +++ b/src/net/eathena/maprecv.h @@ -34,7 +34,6 @@ namespace EAthena void processInstanceCreate(Net::MessageIn &msg); void processInstanceInfo(Net::MessageIn &msg); void processInstanceDelete(Net::MessageIn &msg); - void processSetTilesType(Net::MessageIn &msg); void processAddMapMarker(Net::MessageIn &msg); } // namespace MapRecv } // namespace EAthena diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 96bebd320..2511f8e57 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -36,6 +36,7 @@ #include "net/ea/inventoryrecv.h" #include "net/ea/itemrecv.h" #include "net/ea/loginrecv.h" +#include "net/ea/maprecv.h" #include "net/ea/npcrecv.h" #include "net/ea/partyrecv.h" #include "net/ea/playerrecv.h" diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index 7fd62d8cc..8bd9143cc 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -798,7 +798,7 @@ if (serverVersion > 0) packet(SMSG_ITEM_VISIBLE2, 0x0b18, 28, &ItemRecv::processItemVisible2, 0); packet(SMSG_ITEM_DROPPED2, 0x0b19, 28, &ItemRecv::processItemDropped2, 0); packet(SMSG_BATTLE_EMBLEM2, 0x0b1a, 34, &BattleGroundRecv::processBattleEmblem2, 0); - packet(SMSG_MAP_SET_TILES_TYPE, 0x0b1b, 34, &MapRecv::processSetTilesType, 0); + packet(SMSG_MAP_SET_TILES_TYPE, 0x0b1b, 34, &Ea::MapRecv::processSetTilesType, 0); packet(SMSG_NPC_SKIN, 0x0b1c, -1, &NpcRecv::processNpcSkin, 0); packet(SMSG_PLAYER_KILLED_BY, 0x0b1d, 6, &PlayerRecv::processKilledBy, 0); diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 822e57a97..66bf166e1 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -36,6 +36,7 @@ #include "net/ea/inventoryrecv.h" #include "net/ea/itemrecv.h" #include "net/ea/loginrecv.h" +#include "net/ea/maprecv.h" #include "net/ea/npcrecv.h" #include "net/ea/partyrecv.h" #include "net/ea/playerrecv.h" diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index d75d9774b..97d2d13d7 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -29,7 +29,7 @@ * Protocol version, reported to the tmwa char and mapserver who can adjust * the protocol accordingly. */ -#define CLIENT_PROTOCOL_VERSION 6 +#define CLIENT_PROTOCOL_VERSION 7 namespace TmwAthena { diff --git a/src/net/tmwa/packetsin.inc b/src/net/tmwa/packetsin.inc index f760c979f..4a0529af1 100644 --- a/src/net/tmwa/packetsin.inc +++ b/src/net/tmwa/packetsin.inc @@ -170,3 +170,4 @@ packet(SMSG_WHISPER_RESPONSE, 0x0098, 3, &ChatRecv::processWhispe packet(SMSG_WHO_ANSWER, 0x00c2, 6, &Ea::GameRecv::processWhoAnswer, 0); packet(SMSG_MAP_MASK, 0x0226, 10, &Ea::PlayerRecv::processMapMask, 0); packet(SMSG_PLAYER_CLIENT_COMMAND, 0x0230, -1, &Ea::PlayerRecv::processPlayerClientCommand, 0); +packet(SMSG_MAP_SET_TILES_TYPE, 0x0231, 34, &Ea::MapRecv::processSetTilesType, 0); |