* Minor adjustment to take into account the end of line.

* Fixed the line count in the new error message of npc_parse_function.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11606 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
FlavioJS 2007-10-28 23:48:29 +00:00
parent 5550180be2
commit 82a3432bd4
2 changed files with 13 additions and 7 deletions

View File

@ -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.
2007/10/28
* Minor adjustment to take into account the end of line.
* Fixed the line count in the new error message of npc_parse_function.
* Restricted more the parsing of npc code. (fixes bugreport:317) [FlavioJS]
* Fixed a bug sending on the attachment message [Zephyrus]
2007/10/27

View File

@ -1775,12 +1775,14 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
{// parsing script with curly
const char* script_start;
if( strstr(w4,",{") == NULL )
script_start = strstr(start,",{");
end = strchr(start,'\n');
if( strstr(w4,",{") == NULL || script_start == NULL || (end != NULL && script_start > end) )
{
ShowError("npc_parse_script: Missing left curly ',{' in file '%s', line '%d'. Skipping the rest of the file.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return NULL;// can't continue
}
script_start = strstr(start,",{")+1;
++script_start;
end = npc_skip_script(script_start, buffer, filepath);
if( end == NULL )
@ -2024,20 +2026,22 @@ static const char* npc_parse_function(char* w1, char* w2, char* w3, char* w4, co
struct script_code *script;
struct script_code *oldscript;
const char* end;
const char* script_start;
start = strstr(start,"\t{");
if( *w4 != '{' || start == NULL )
script_start = strstr(start,"\t{");
end = strchr(start,'\n');
if( *w4 != '{' || script_start == NULL || (end != NULL && script_start > end) )
{
ShowError("npc_parse_function: Missing left curly '%%TAB%%{' in file '%s', line '%d'. Skipping the rest of the file.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return NULL;// can't continue
}
++script_start;
end = npc_skip_script(start,buffer,filepath);
end = npc_skip_script(script_start,buffer,filepath);
if( end == NULL )
return NULL;// (simple) parse error, don't continue
start = strchr(start,'{');
script = parse_script(start, filepath, strline(buffer,start-buffer), SCRIPT_RETURN_EMPTY_SCRIPT);
script = parse_script(script_start, filepath, strline(buffer,start-buffer), SCRIPT_RETURN_EMPTY_SCRIPT);
if( script == NULL )// parse error, continue
return end;