summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-28 23:48:29 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-28 23:48:29 +0000
commitccbcf5a85c209341e6471269abef23b58633d083 (patch)
tree8ef5e830c182706ccdc4b0581c1d63b91ed6e0df
parent46242ebf98468f8afc9ca755f84c23328b7a7402 (diff)
downloadhercules-ccbcf5a85c209341e6471269abef23b58633d083.tar.gz
hercules-ccbcf5a85c209341e6471269abef23b58633d083.tar.bz2
hercules-ccbcf5a85c209341e6471269abef23b58633d083.tar.xz
hercules-ccbcf5a85c209341e6471269abef23b58633d083.zip
* 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11606 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/npc.c18
2 files changed, 13 insertions, 7 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 8f55ed2d2..8bae71d38 100644
--- a/Changelog-Trunk.txt
+++ b/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.
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
diff --git a/src/map/npc.c b/src/map/npc.c
index 97744a348..3649731ed 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -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;