summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxazax-hun <xazax-hun@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-25 18:49:58 +0000
committerxazax-hun <xazax-hun@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-25 18:49:58 +0000
commit10921d4dbfbe634087c9711971455b7d9281ed31 (patch)
treed1474bb6742a9956987dbbe0aa9c46668d8cae4e
parentcb5a1ec7d39927184ce79e05f9c453603cb47883 (diff)
downloadhercules-10921d4dbfbe634087c9711971455b7d9281ed31.tar.gz
hercules-10921d4dbfbe634087c9711971455b7d9281ed31.tar.bz2
hercules-10921d4dbfbe634087c9711971455b7d9281ed31.tar.xz
hercules-10921d4dbfbe634087c9711971455b7d9281ed31.zip
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
-rw-r--r--doc/script_commands.txt10
-rw-r--r--src/map/script.c18
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 "<map name>",<flag>;
+*setmapflag "<map name>",<flag>{,<zone>};
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 "<map name>",<flag>;
+*removemapflag "<map name>",<flag>{,<zone>};
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("<map name>",<flag>)
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"),