Applied Rayce's improvements to the npc script parser (see bugreport:387 for details).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11715 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-11-11 10:59:41 +00:00
parent 95f651807d
commit a5b2c3b30c
2 changed files with 16 additions and 11 deletions

View File

@ -4,6 +4,7 @@ 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.
2007/11/12
* Applied Rayce's improvements to the npc script parser [ultramage]
* Made on-touch areas work with walking npcs (is somewhat process
intensive, but people do not really care about that, do they?) [Skotlex]
* Fixed a bug in r11384 letting you bypass requirements for some skills

View File

@ -1047,8 +1047,8 @@ const char* parse_line(const char* p)
p=skip_space(p);
if(*p==';') {
// if(); for(); while(); のために閉じ判定
p = parse_syntax_close(p);
return p+1;
p = parse_syntax_close(p + 1);
return p;
}
if(*p==')' && parse_syntax_for_flag)
return p+1;
@ -1178,10 +1178,8 @@ const char* parse_syntax(const char* p)
syntax.curly_count--;
}
p = skip_space(p2);
if(*p != ';') {
if(*p != ';')
disp_error_message("parse_syntax: need ';'",p);
}
p++;
// if, for , while の閉じ判定
p = parse_syntax_close(p + 1);
return p;
@ -1292,7 +1290,6 @@ const char* parse_syntax(const char* p)
p = skip_space(p2);
if(*p != ';')
disp_error_message("parse_syntax: need ';'",p);
p++;
// if, for , while の閉じ判定
p = parse_syntax_close(p + 1);
return p;
@ -1436,16 +1433,19 @@ const char* parse_syntax(const char* p)
p = skip_word(func_name);
if( p == func_name )
disp_error_message("parse_syntax:function: function name is missing or invalid", p);
if( *skip_space(p) == ';' )
p2 = skip_space(p);
if( *p2 == ';' )
{// function <name> ;
// function declaration - just register the name
int l;
l = add_word(func_name);
if( str_data[l].type == C_NOP )//## ??? [FlavioJS]
str_data[l].type = C_USERFUNC;
return skip_space(p) + 1;
}
else
// if, for , while の閉じ判定
p = parse_syntax_close(p2 + 1);
return p; }
else if(*p2 == '{')
{// function <name> <line/block of code>
char label[256];
int l;
@ -1472,6 +1472,10 @@ const char* parse_syntax(const char* p)
strdb_put(scriptlabel_db, GETSTRING(str_data[l].str), (void*)script_pos);
return skip_space(p);
}
else
{
disp_error_message("expect ';' or '{' at function syntax",p);
}
}
break;
case 'i':
@ -1727,7 +1731,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
l=add_str(label);
set_label(l,script_pos,p);
syntax.curly_count--;
return p + 1;
return p;
} else {
*flag = 0;
return p;