diff options
author | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-12-06 15:12:55 +0000 |
---|---|---|
committer | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-12-06 15:12:55 +0000 |
commit | 13c58cce0a44f607c96771d7014791eba1a57429 (patch) | |
tree | 3919a67f4a4357a544c8a77f714cd5d8524e5a0b /src/map/npc.c | |
parent | 71392bc0305b06e18c99892d0a5b3fb4aaaf22c9 (diff) | |
download | hercules-13c58cce0a44f607c96771d7014791eba1a57429.tar.gz hercules-13c58cce0a44f607c96771d7014791eba1a57429.tar.bz2 hercules-13c58cce0a44f607c96771d7014791eba1a57429.tar.xz hercules-13c58cce0a44f607c96771d7014791eba1a57429.zip |
* Removed the attempts to recover from invalid syntax in npc_parsesrcfile since they can produce incorrect results (spaces in sscanf can match \n's and company).
* Made script_rid2sd report the script source directly and changed related return 1's to return 0's to avoid double script source reports.
* Added missing return 0's after script_rid2sd is used and an extra error message in buildin_set/buildin_setd.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11860 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 26ce12757..e8d5c6478 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2610,18 +2610,10 @@ void npc_parsesrcfile(const char* filepath) // w1<TAB>w2<TAB>w3<TAB>w4 if( (count = sscanf(p, "%[^\t\r\n]\t%[^\t\r\n]\t%[^\t\r\n]\t%n%[^\r\n]", w1, w2, w3, &w4pos, w4)) < 3 ) - { - if( (count = sscanf(p, "%s %s %[^\t]\t %n%[^\n]", w1, w2, w3, &w4pos, w4)) == 4 - || (count = sscanf(p, "%s %s %s %n%[^\n]\n", w1, w2, w3, &w4pos, w4)) >= 3 ) - {// Incorrect syntax, try to parse - ShowWarning("npc_parsesrcfile: Incorrect separator syntax in file '%s', line '%d'. Use tabs instead of spaces!\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,p-buffer), w1, w2, w3, w4); - } - else - {// Unknown syntax, try to continue - ShowError("npc_parsesrcfile: Unknown syntax in file '%s', line '%d'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,p-buffer), w1, w2, w3, w4); - p = strchr(p,'\n');// next line - continue; - } + {// Unknown syntax, try to continue + ShowError("npc_parsesrcfile: Unknown syntax in file '%s', line '%d'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,p-buffer), w1, w2, w3, w4); + p = strchr(p,'\n');// next line + continue; } if( strcmp(w1,"-") !=0 && strcasecmp(w1,"function") != 0 ) |