summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-16 17:32:47 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-16 17:32:47 +0000
commit3a87ef7cea85ca778cd5cd59fa9703b5f4412291 (patch)
tree6490c250561c93b13e4c243fcac1e8fc04c0f125
parentaf9e025ed822f5e30655323af3cb70f3b51b559e (diff)
downloadhercules-3a87ef7cea85ca778cd5cd59fa9703b5f4412291.tar.gz
hercules-3a87ef7cea85ca778cd5cd59fa9703b5f4412291.tar.bz2
hercules-3a87ef7cea85ca778cd5cd59fa9703b5f4412291.tar.xz
hercules-3a87ef7cea85ca778cd5cd59fa9703b5f4412291.zip
* Tweaked the loop in parse_script to better handle when the outer brackets aren't checked.
* Fixed a typo in skip_space that stopped skipping characters when it encountered a '*' or '/' in a block comment. ex: /* this will give a parse error after this character->* */ /* same thing here->/ */ git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11487 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt5
-rw-r--r--src/map/script.c12
2 files changed, 14 insertions, 3 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 5f27cfa05..4461d63ea 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,11 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2007/10/16
+ * Tweaked the loop in parse_script to better handle when the outer
+ brackets aren't checked.
+ * Fixed a typo in skip_space that stopped skipping characters when it
+ encountered a '*' or '/' in a block comment. [FlavioJS]
2007/10/15
* Fixed NPC_CRITICALWOUND to reduce heal by 20% per level [Playtester]
* Fixing TK Mission asigning non spawning mobs. [Zephyrus]
diff --git a/src/map/script.c b/src/map/script.c
index 1fa0f3150..80aabb33b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -461,6 +461,7 @@ static void script_reportdata(struct script_data* data)
else
{// ???
ShowDebug("Data: reference name='%s' type=%s\n", reference_getname(data), script_op2name(data->type));
+ ShowDebug("Please report this!!! - str_data.type=%s\n", script_op2name(str_data[reference_getid(data)].type);
}
break;
case C_POS:// label
@@ -740,7 +741,7 @@ const char* skip_space(const char* p)
{
if( *p == '\0' )
disp_error_message("script:skip_space: end of file while parsing block comment. expected "CL_BOLD"*/"CL_NORM, p);
- if( *p == '*' || p[1] == '/' )
+ if( *p == '*' && p[1] == '/' )
{// end of block comment
p += 2;
break;
@@ -1897,6 +1898,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
int i;
struct script_code *code;
static int first=1;
+ char end;
if( src == NULL )
return NULL;// empty script
@@ -1961,6 +1963,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
script_buf = NULL;
return NULL;
}
+ end = '\0';
}
else
{// requires brackets around the script
@@ -1975,11 +1978,13 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
script_buf = NULL;
return NULL;
}
+ end = '}';
}
- while (*p && (*p != '}' || syntax.curly_count != 0) )
+ while( syntax.curly_count != 0 || *p != end )
{
- p=skip_space(p);
+ if( *p == '\0' )
+ disp_error_message("unexpected end of script",p);
// labelだけ特殊処理
tmpp=skip_space(skip_word(p));
if(*tmpp==':' && !(!strncasecmp(p,"default:",8) && p + 7 == tmpp)){
@@ -1988,6 +1993,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
if( parse_options&SCRIPT_USE_LABEL_DB )
strdb_put(scriptlabel_db, GETSTRING(str_data[i].str), (void*)script_pos);
p=tmpp+1;
+ p=skip_space(p);
continue;
}