summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-14 16:54:21 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-14 16:54:21 +0300
commit4af398b58583dd834090f51b70adc749cd082cbb (patch)
treeb11ebd7bb9e9aae0eaded8b53e35ab22154a0746 /src/net/ea
parentf42895110758580885e52c6dffbb9e090c9ee101 (diff)
downloadmanaplus-4af398b58583dd834090f51b70adc749cd082cbb.tar.gz
manaplus-4af398b58583dd834090f51b70adc749cd082cbb.tar.bz2
manaplus-4af398b58583dd834090f51b70adc749cd082cbb.tar.xz
manaplus-4af398b58583dd834090f51b70adc749cd082cbb.zip
Add into tmwa packet SMSG_MAP_SET_TILES_TYPE. Change protocol version to 7.
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/maprecv.cpp58
-rw-r--r--src/net/ea/maprecv.h40
2 files changed, 98 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
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