From 10921d4dbfbe634087c9711971455b7d9281ed31 Mon Sep 17 00:00:00 2001 From: xazax-hun Date: Sun, 25 Dec 2011 18:49:58 +0000 Subject: Fixed setting and removing restricted mapflags. bugreport:4119 git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15273 54d463be-8e91-2dee-dedb-b68131a5f0ec --- doc/script_commands.txt | 10 +++++++--- src/map/script.c | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 7029b9b72..cfe409d99 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -1,4 +1,4 @@ -//===== Athena Doc ======================================== +//===== Athena Doc ======================================== //= rAthena Script Commands //===== Description ======================================= //= A reference manual for the rAthena scripting language. @@ -5918,7 +5918,7 @@ kick the reconnecting players off to the alternate map given to the coordinates --------------------------------------- -*setmapflag "",; +*setmapflag "",{,}; This command marks a specified map with a map flag given. Map flags alter the behavior of the map, you can see the list of the available ones in @@ -5933,13 +5933,17 @@ skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewal current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds, mf_fireworks) and whether night will be in effect on this map (mf_nightenabled). +The zone optional parameter is used to set the zone for restricted mapflags. + --------------------------------------- -*removemapflag "",; +*removemapflag "",{,}; This command removes a mapflag from a specified map. See 'setmapflag' for a list of mapflags. +The zone optional parameter is used to remove the zone from restricted mapflags. + --------------------------------------- *getmapflag("",) diff --git a/src/map/script.c b/src/map/script.c index 4ce9e380e..1fdbc7c01 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9787,7 +9787,10 @@ BUILDIN_FUNC(setmapflag) case MF_NORETURN: map[m].flag.noreturn = 1; break; case MF_NOWARPTO: map[m].flag.nowarpto = 1; break; case MF_NIGHTMAREDROP: map[m].flag.pvp_nightmaredrop = 1; break; - case MF_RESTRICTED: map[m].flag.restricted = 1; break; + case MF_RESTRICTED: + map[m].zone |= 1<<((int)atoi(val)+1); + map[m].flag.restricted=1; + break; case MF_NOCOMMAND: map[m].nocommand = (!val || atoi(val) <= 0) ? 100 : atoi(val); break; case MF_NODROP: map[m].flag.nodrop = 1; break; case MF_JEXP: map[m].jexp = (!val || atoi(val) < 0) ? 100 : atoi(val); break; @@ -9814,9 +9817,13 @@ BUILDIN_FUNC(removemapflag) { int m,i; const char *str; + const char *val=NULL; str=script_getstr(st,2); i=script_getnum(st,3); + if(script_hasdata(st,4)){ + val=script_getstr(st,4); + } m = map_mapname2mapid(str); if(m >= 0) { switch(i) { @@ -9858,7 +9865,12 @@ BUILDIN_FUNC(removemapflag) case MF_NORETURN: map[m].flag.noreturn = 0; break; case MF_NOWARPTO: map[m].flag.nowarpto = 0; break; case MF_NIGHTMAREDROP: map[m].flag.pvp_nightmaredrop = 0; break; - case MF_RESTRICTED: map[m].flag.restricted = 0; break; + case MF_RESTRICTED: + map[m].zone ^= 1<<((int)atoi(val)+1); + if (map[m].zone == 0){ + map[m].flag.restricted=0; + } + break; case MF_NOCOMMAND: map[m].nocommand = 0; break; case MF_NODROP: map[m].flag.nodrop = 0; break; case MF_JEXP: map[m].jexp = 0; break; @@ -16134,7 +16146,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(setmapflagnosave,"ssii"), BUILDIN_DEF(getmapflag,"si"), BUILDIN_DEF(setmapflag,"si?"), - BUILDIN_DEF(removemapflag,"si"), + BUILDIN_DEF(removemapflag,"si?"), BUILDIN_DEF(pvpon,"s"), BUILDIN_DEF(pvpoff,"s"), BUILDIN_DEF(gvgon,"s"), -- cgit v1.2.3-70-g09d2