1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2008 Lloyd Bryant <[email protected]> |
4 |
|
|
* Copyright (C) 2011-2019 The ManaPlus Developers |
5 |
|
|
* Copyright (C) 2019-2021 Andrei Karas |
6 |
|
|
* |
7 |
|
|
* This file is part of The ManaPlus Client. |
8 |
|
|
* |
9 |
|
|
* This program is free software; you can redistribute it and/or modify |
10 |
|
|
* it under the terms of the GNU General Public License as published by |
11 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
12 |
|
|
* any later version. |
13 |
|
|
* |
14 |
|
|
* This program is distributed in the hope that it will be useful, |
15 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 |
|
|
* GNU General Public License for more details. |
18 |
|
|
* |
19 |
|
|
* You should have received a copy of the GNU General Public License |
20 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
#include "net/ea/maprecv.h" |
24 |
|
|
|
25 |
|
|
#include "gui/viewport.h" |
26 |
|
|
|
27 |
|
|
#include "resources/map/map.h" |
28 |
|
|
|
29 |
|
|
#include "net/messagein.h" |
30 |
|
|
|
31 |
|
|
#include "debug.h" |
32 |
|
|
|
33 |
|
|
namespace Ea |
34 |
|
|
{ |
35 |
|
|
|
36 |
|
|
void MapRecv::processSetTilesType(Net::MessageIn &msg) |
37 |
|
|
{ |
38 |
|
|
const int x1 = msg.readInt16("x1"); |
39 |
|
|
const int y1 = msg.readInt16("y1"); |
40 |
|
|
const int x2 = msg.readInt16("x2"); |
41 |
|
|
const int y2 = msg.readInt16("y2"); |
42 |
|
|
const BlockTypeT mask = static_cast<BlockTypeT>(msg.readInt32("mask")); |
43 |
|
|
const int layer = msg.readInt32("layer"); |
44 |
|
|
const std::string name = msg.readString(16, "map name"); |
45 |
|
|
if (layer != 0) |
46 |
|
|
return; |
47 |
|
|
Map *const map = viewport->getMap(); |
48 |
|
|
if ((map != nullptr) && map->getGatName() == name) |
49 |
|
|
{ |
50 |
|
|
for (int y = y1; y <= y2; y ++) |
51 |
|
|
{ |
52 |
|
|
for (int x = x1; x <= x2; x ++) |
53 |
|
|
map->setBlockMask(x, y, mask); |
54 |
|
|
} |
55 |
|
|
map->updateConditionLayers(); |
56 |
|
|
map->preCacheLayers(); |
57 |
|
|
} |
58 |
|
|
} |
59 |
|
|
|
60 |
|
2 |
} // namespace Ea |