ManaPlus
Functions
Ea::MapRecv Namespace Reference

Functions

void processSetTilesType (Net::MessageIn &msg)
 

Function Documentation

◆ processSetTilesType()

void Ea::MapRecv::processSetTilesType ( Net::MessageIn msg)

Definition at line 36 of file maprecv.cpp.

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 }
BlockType ::T BlockTypeT
Definition: blocktype.h:41
Definition: map.h:75
void preCacheLayers()
Definition: map.cpp:1746
void setBlockMask(const int x, const int y, const BlockTypeT type)
Definition: map.cpp:746
void updateConditionLayers()
Definition: map.cpp:1732
const std::string getGatName() const
Definition: map.cpp:855
Map * getMap() const
Definition: viewport.h:135
Viewport * viewport
Definition: viewport.cpp:36
bool msg(InputEvent &event)
Definition: chat.cpp:39

References Map::getGatName(), Viewport::getMap(), Actions::msg(), Map::preCacheLayers(), Map::setBlockMask(), Map::updateConditionLayers(), viewport, x, and y.