summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-28 12:55:55 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-28 12:55:55 +0300
commitb3bed3c6c764cae9706be429ea0222cad38e2e43 (patch)
treed8dbdd8595fd1c42f3e388385b0430b0a40fb8a1 /src/map/script.c
parent833e59fee3e6538863ef7277d7b679fb9f2fe750 (diff)
downloadplugin-b3bed3c6c764cae9706be429ea0222cad38e2e43.tar.gz
plugin-b3bed3c6c764cae9706be429ea0222cad38e2e43.tar.bz2
plugin-b3bed3c6c764cae9706be429ea0222cad38e2e43.tar.xz
plugin-b3bed3c6c764cae9706be429ea0222cad38e2e43.zip
add map mask and script functions for manipulate with it.
New script functions: setmapmask - set new map mask. addmapmask - add new map mask to current mask. removemapmask - remove new mask from current mask. getmapmask - return current map mask.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index ca6907c..93ca052 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -20,6 +20,8 @@
#include "map/script.h"
#include "map/clif.h"
#include "map/lang.h"
+#include "map/mapd.h"
+#include "map/mapdext.h"
#include "map/scriptdefines.h"
#include "map/send.h"
#include "map/session.h"
@@ -431,3 +433,66 @@ BUILDIN(miscEffect)
clif->specialeffect(bl, type, AREA);
return true;
}
+
+BUILDIN(setMapMask)
+{
+ const char *const mapName = script_getstr(st, 2);
+ if (!mapName)
+ return true;
+ const int m = map->mapname2mapid(mapName);
+ if (m < 0)
+ return false;
+ getMapData(m);
+
+ const int val = script_getnum(st, 3);
+ mapData->mask = val;
+ return true;
+}
+
+BUILDIN(getMapMask)
+{
+ const char *const mapName = script_getstr(st, 2);
+ if (!mapName)
+ {
+ script_pushint(st, 0);
+ return true;
+ }
+ const int m = map->mapname2mapid(mapName);
+ if (m < 0)
+ {
+ script_pushint(st, 0);
+ return false;
+ }
+ getMapDataReturn(m, 0);
+ script_pushint(st, mapData->mask);
+ return true;
+}
+
+BUILDIN(addMapMask)
+{
+ const char *const mapName = script_getstr(st, 2);
+ if (!mapName)
+ return true;
+ const int m = map->mapname2mapid(mapName);
+ if (m < 0)
+ return false;
+ getMapData(m);
+ const int val = script_getnum(st, 3);
+ mapData->mask |= val;
+ return true;
+}
+
+BUILDIN(removeMapMask)
+{
+ const char *const mapName = script_getstr(st, 2);
+ if (!mapName)
+ return true;
+ const int m = map->mapname2mapid(mapName);
+ if (m < 0)
+ return false;
+ getMapData(m);
+ const int val = script_getnum(st, 3);
+ mapData->mask |= val;
+ mapData->mask ^= val;
+ return true;
+}