From f672c7242dfa8d278d826f1e460af96265ca307c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 16 Oct 2015 00:32:58 +0300 Subject: Impliment packet SMSG_MAP_SET_TILES_TYPE (hercules) This allow change collision types from server. --- src/net/eathena/maprecv.cpp | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'src/net/eathena/maprecv.cpp') diff --git a/src/net/eathena/maprecv.cpp b/src/net/eathena/maprecv.cpp index 06a039306..df43cac76 100644 --- a/src/net/eathena/maprecv.cpp +++ b/src/net/eathena/maprecv.cpp @@ -22,8 +22,14 @@ #include "logger.h" +#include "enums/resources/map/blocktype.h" + +#include "gui/viewport.h" + #include "net/messagein.h" +#include "resources/map/map.h" + #include "debug.h" namespace EAthena @@ -59,13 +65,26 @@ void MapRecv::processInstanceDelete(Net::MessageIn &msg) void MapRecv::processSetTilesType(Net::MessageIn &msg) { - UNIMPLIMENTEDPACKET; - msg.readInt16("x1"); - msg.readInt16("y1"); - msg.readInt16("x2"); - msg.readInt16("y2"); - msg.readInt32("mask"); - msg.readString(16, "map name"); + 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 BlockType mask = fromInt(msg.readInt32("mask"), BlockType); + const std::string name = msg.readString(16, "map name"); + + Map *const map = viewport->getMap(); +// logger->log("map test name: %s, mask %d", map->getGatName().c_str(), (int)mask); + if (map && map->getGatName() == name) + { + for (int y = y1; y <= y2; y ++) + { + for (int x = x1; x <= x2; x ++) + { + logger->log("set col %d,%d", x, y); + map->setBlockMask(x, y, mask); + } + } + } } } // namespace EAthena -- cgit v1.2.3-60-g2f50