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/ea/maprecv.cpp | |
parent | f42895110758580885e52c6dffbb9e090c9ee101 (diff) | |
download | mv-4af398b58583dd834090f51b70adc749cd082cbb.tar.gz mv-4af398b58583dd834090f51b70adc749cd082cbb.tar.bz2 mv-4af398b58583dd834090f51b70adc749cd082cbb.tar.xz mv-4af398b58583dd834090f51b70adc749cd082cbb.zip |
Add into tmwa packet SMSG_MAP_SET_TILES_TYPE. Change protocol version to 7.
Diffstat (limited to 'src/net/ea/maprecv.cpp')
-rw-r--r-- | src/net/ea/maprecv.cpp | 58 |
1 files changed, 58 insertions, 0 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 |