Browse Source

Fixed setting and removing restricted mapflags. bugreport:4119

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15273 54d463be-8e91-2dee-dedb-b68131a5f0ec
xazax-hun 13 years ago
parent
commit
33cc72690e
2 changed files with 22 additions and 6 deletions
  1. 7 3
      doc/script_commands.txt
  2. 15 3
      src/map/script.c

+ 7 - 3
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>)

+ 15 - 3
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"),