Selaa lähdekoodia

- Fallback for parenthesis argument lists in the script engine. "func (exp) , ..." is valid again.

Why didn't I think of this earlier? /hmm

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9565 54d463be-8e91-2dee-dedb-b68131a5f0ec
FlavioJS 18 vuotta sitten
vanhempi
commit
11cb7227b2
2 muutettua tiedostoa jossa 13 lisäystä ja 2 poistoa
  1. 2 0
      Changelog-Trunk.txt
  2. 11 2
      src/map/script.c

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/12/23
+	* Fallback for parenthesis argument lists in the script engine. 
+	  "func (exp) , ..." is valid again.
 	* Moved "#include <limits.h>" to cbasetypes.h to ensure it's included 
 	  before checking if UINT_MAX has been defined.
 	* Minor changes in pc_readdb related to max_level being unsigned.

+ 11 - 2
src/map/script.c

@@ -853,8 +853,17 @@ const char* parse_line(const char* p)
 		p=parse_expr(p);
 		p=skip_space(p);
 		// ˆø�”‹æ�Ø‚è‚Ì,�ˆ—�
-		if(*p==',') {
-			if(arg == NULL || arg[j] == '*' || i+1 < j)
+		if( *p==',' ) {
+			if( arg == NULL || arg[j] == '*' || i+1 < j )
+				p++; // the next argument is valid, skip the comma
+		}
+		else if( end2 && i == 0 && *p == ')' && *skip_space(p+1) == ',' )
+		{// parenthesis argument list fallback for "func (exp) , ..."
+			end = end2;
+			parse_syntax_for_flag = old_flag;
+			end2 = 0;
+			p=skip_space(p+1);
+			if( arg == NULL || arg[j] == '*' || i+1 < j )
 				p++; // the next argument is valid, skip the comma
 		}
 		else if(*p!=end && script_config.warn_cmd_no_comma){