From 4af398b58583dd834090f51b70adc749cd082cbb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 14 May 2016 16:54:21 +0300 Subject: Add into tmwa packet SMSG_MAP_SET_TILES_TYPE. Change protocol version to 7. --- src/net/ea/maprecv.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/net/ea/maprecv.cpp (limited to 'src/net/ea/maprecv.cpp') 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 + * 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 . + */ + +#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(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 -- cgit v1.2.3-60-g2f50