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:
parent
95f651807d
commit
a5b2c3b30c
@ -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.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
|
|
||||||
2007/11/12
|
2007/11/12
|
||||||
|
* Applied Rayce's improvements to the npc script parser [ultramage]
|
||||||
* Made on-touch areas work with walking npcs (is somewhat process
|
* Made on-touch areas work with walking npcs (is somewhat process
|
||||||
intensive, but people do not really care about that, do they?) [Skotlex]
|
intensive, but people do not really care about that, do they?) [Skotlex]
|
||||||
* Fixed a bug in r11384 letting you bypass requirements for some skills
|
* Fixed a bug in r11384 letting you bypass requirements for some skills
|
||||||
|
@ -1047,8 +1047,8 @@ const char* parse_line(const char* p)
|
|||||||
p=skip_space(p);
|
p=skip_space(p);
|
||||||
if(*p==';') {
|
if(*p==';') {
|
||||||
// if(); for(); while(); のために閉じ判定
|
// if(); for(); while(); のために閉じ判定
|
||||||
p = parse_syntax_close(p);
|
p = parse_syntax_close(p + 1);
|
||||||
return p+1;
|
return p;
|
||||||
}
|
}
|
||||||
if(*p==')' && parse_syntax_for_flag)
|
if(*p==')' && parse_syntax_for_flag)
|
||||||
return p+1;
|
return p+1;
|
||||||
@ -1178,10 +1178,8 @@ const char* parse_syntax(const char* p)
|
|||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
}
|
}
|
||||||
p = skip_space(p2);
|
p = skip_space(p2);
|
||||||
if(*p != ';') {
|
if(*p != ';')
|
||||||
disp_error_message("parse_syntax: need ';'",p);
|
disp_error_message("parse_syntax: need ';'",p);
|
||||||
}
|
|
||||||
p++;
|
|
||||||
// if, for , while の閉じ判定
|
// if, for , while の閉じ判定
|
||||||
p = parse_syntax_close(p + 1);
|
p = parse_syntax_close(p + 1);
|
||||||
return p;
|
return p;
|
||||||
@ -1292,7 +1290,6 @@ const char* parse_syntax(const char* p)
|
|||||||
p = skip_space(p2);
|
p = skip_space(p2);
|
||||||
if(*p != ';')
|
if(*p != ';')
|
||||||
disp_error_message("parse_syntax: need ';'",p);
|
disp_error_message("parse_syntax: need ';'",p);
|
||||||
p++;
|
|
||||||
// if, for , while の閉じ判定
|
// if, for , while の閉じ判定
|
||||||
p = parse_syntax_close(p + 1);
|
p = parse_syntax_close(p + 1);
|
||||||
return p;
|
return p;
|
||||||
@ -1436,16 +1433,19 @@ const char* parse_syntax(const char* p)
|
|||||||
p = skip_word(func_name);
|
p = skip_word(func_name);
|
||||||
if( p == func_name )
|
if( p == func_name )
|
||||||
disp_error_message("parse_syntax:function: function name is missing or invalid", p);
|
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 <name> ;
|
||||||
// function declaration - just register the name
|
// function declaration - just register the name
|
||||||
int l;
|
int l;
|
||||||
l = add_word(func_name);
|
l = add_word(func_name);
|
||||||
if( str_data[l].type == C_NOP )//## ??? [FlavioJS]
|
if( str_data[l].type == C_NOP )//## ??? [FlavioJS]
|
||||||
str_data[l].type = C_USERFUNC;
|
str_data[l].type = C_USERFUNC;
|
||||||
return skip_space(p) + 1;
|
|
||||||
}
|
// if, for , while の閉じ判定
|
||||||
else
|
p = parse_syntax_close(p2 + 1);
|
||||||
|
return p; }
|
||||||
|
else if(*p2 == '{')
|
||||||
{// function <name> <line/block of code>
|
{// function <name> <line/block of code>
|
||||||
char label[256];
|
char label[256];
|
||||||
int l;
|
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);
|
strdb_put(scriptlabel_db, GETSTRING(str_data[l].str), (void*)script_pos);
|
||||||
return skip_space(p);
|
return skip_space(p);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
disp_error_message("expect ';' or '{' at function syntax",p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
@ -1727,7 +1731,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
|
|||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
return p + 1;
|
return p;
|
||||||
} else {
|
} else {
|
||||||
*flag = 0;
|
*flag = 0;
|
||||||
return p;
|
return p;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user