diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 35a257a31c..0241ccd419 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,9 @@ 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. 2006/11/28 + * Applied The Ultra Mage's patch to use strict npc header formatting + parsing. Updated the relevant stock scripts/mapflags that didn't conform to + the standard. [Skotlex] * Moved the blocking of casting supportive skills on homunculus from battle_check_target to status_check_skilluse as bct is not invoked unless the skill is offensive (or party/guild only) [Skotlex] diff --git a/conf-tmpl/mapflag/indoors.txt b/conf-tmpl/mapflag/indoors.txt index 4d6a7a4e7f..473c2da6e8 100644 --- a/conf-tmpl/mapflag/indoors.txt +++ b/conf-tmpl/mapflag/indoors.txt @@ -68,14 +68,14 @@ auction_01.gat mapflag indoors auction_02.gat mapflag indoors ra_in01.gat mapflag indoors ra_temin.gat mapflag indoors -que_rachel.gat mapflag indoors -yuno_pre.gat mapflag indoors -lhz_que01.gat mapflag indoors -que_job01.gat mapflag indoors -thana_step.gat mapflag indoors -kh_mansion.gat mapflag indoors -kh_rossi.gat mapflag indoors -kh_school.gat mapflag indoors -kh_vila.gat mapflag indoors -que_bingo.gat mapflag indoors -que_ng.gat mapflag indoors +que_rachel.gat mapflag indoors +yuno_pre.gat mapflag indoors +lhz_que01.gat mapflag indoors +que_job01.gat mapflag indoors +thana_step.gat mapflag indoors +kh_mansion.gat mapflag indoors +kh_rossi.gat mapflag indoors +kh_school.gat mapflag indoors +kh_vila.gat mapflag indoors +que_bingo.gat mapflag indoors +que_ng.gat mapflag indoors diff --git a/conf-tmpl/mapflag/night.txt b/conf-tmpl/mapflag/night.txt index 06d40d8c03..1b0e600864 100644 --- a/conf-tmpl/mapflag/night.txt +++ b/conf-tmpl/mapflag/night.txt @@ -198,7 +198,7 @@ hu_fild05.gat mapflag nightenabled hu_fild04.gat mapflag nightenabled hu_fild01.gat mapflag nightenabled yuno_fild06.gat mapflag nightenabled -tha_scene01.gat mapflag nightenabled +tha_scene01.gat mapflag nightenabled hugel.gat mapflag nightenabled p_track01.gat mapflag nightenabled p_track01.gat mapflag nightenabled @@ -227,4 +227,4 @@ ra_fild11.gat mapflag nightenabled ra_fild12.gat mapflag nightenabled ra_fild13.gat mapflag nightenabled ra_temple.gat mapflag nightenabled -ra_temsky.gat mapflag nightenabled \ No newline at end of file +ra_temsky.gat mapflag nightenabled diff --git a/conf-tmpl/mapflag/noicewall.txt b/conf-tmpl/mapflag/noicewall.txt index fd9ddbdb5a..4d89791c09 100644 --- a/conf-tmpl/mapflag/noicewall.txt +++ b/conf-tmpl/mapflag/noicewall.txt @@ -44,13 +44,13 @@ payon_in01.gat mapflag noicewall payon_in02.gat mapflag noicewall payon_in03.gat mapflag noicewall payon.gat mapflag noicewall -pay_arche.gat mapflag noicewall +pay_arche.gat mapflag noicewall prt_are_in.gat mapflag noicewall prt_are01.gat mapflag noicewall prt_castle.gat mapflag noicewall prt_church.gat mapflag noicewall prt_in.gat mapflag noicewall -prontera.gat mapflag noicewall +prontera.gat mapflag noicewall sec_in01.gat mapflag noicewall job_sword1.gat mapflag noicewall um_in.gat mapflag noicewall diff --git a/conf-tmpl/mapflag/noteleport.txt b/conf-tmpl/mapflag/noteleport.txt index e9b7b02687..a6b9fbf18f 100644 --- a/conf-tmpl/mapflag/noteleport.txt +++ b/conf-tmpl/mapflag/noteleport.txt @@ -63,8 +63,8 @@ yuno.gat mapflag noteleport yuno_pre.gat mapflag noteleport y_airport.gat mapflag noteleport lhz_airport.gat mapflag noteleport -einbroch.gat mapflag noteleport -einbech.gat mapflag noteleport +einbroch.gat mapflag noteleport +einbech.gat mapflag noteleport lhz_que01.gat mapflag noteleport lhz_cube.gat mapflag noteleport lhz_in01.gat mapflag noteleport @@ -89,7 +89,7 @@ auction_02.gat mapflag noteleport ra_in01.gat mapflag noteleport ra_temin.gat mapflag noteleport ra_temsky.gat mapflag noteleport -que_rachel.gat mapflag noteleport +que_rachel.gat mapflag noteleport kh_mansion.gat mapflag noteleport kh_rossi.gat mapflag noteleport kh_school.gat mapflag noteleport diff --git a/src/map/npc.c b/src/map/npc.c index 44b73d8f5b..236f0a7e05 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2616,7 +2616,7 @@ static int npc_parse_mapcell (char *w1, char *w2, char *w3, char *w4) void npc_parsesrcfile (char *name) { int m, lines = 0; - char line[1024]; + char line[2048]; FILE *fp = fopen (name,"r"); if (fp == NULL) { @@ -2626,33 +2626,34 @@ void npc_parsesrcfile (char *name) current_file = name; while (fgets(line, sizeof(line) - 1, fp)) { - char w1[1024], w2[1024], w3[1024], w4[1024], mapname[1024]; - int i, j, w4pos, count; + char w1[2048], w2[2048], w3[2048], w4[2048], mapname[2048]; + int i, w4pos, count; lines++; if (line[0] == '/' && line[1] == '/') continue; - // 不要なスペースやタブの連続は詰める - for (i = j = 0; line[i]; i++) { - if (line[i]==' ') { - if (!((line[i+1] && (isspace((unsigned char)line[i+1]) || line[i+1]==',')) || - (j && line[j-1]==','))) - line[j++]=' '; - } else if (line[i]=='\t') { - if (!(j && line[j-1]=='\t')) - line[j++]='\t'; - } else - line[j++]=line[i]; - } - line[j] = '\0'; //Forget to terminate the string. From [jA 1091] + + if (!sscanf(line, " %n", &i) && i == strlen(line)) // just whitespace + continue; + // 最初はタブ区切りでチェックしてみて、ダメならスペース区切りで確認 w1[0] = w2[0] = w3[0] = w4[0] = '\0'; //It's best to initialize values //to prevent passing previously parsed values to the parsers when not all //fields are specified. [Skotlex] - if ((count = sscanf(line,"%[^\t]\t%[^\t]\t%[^\t\r\n]\t%n%[^\t\r\n]", w1, w2, w3, &w4pos, w4)) < 3 && - (count = sscanf(line,"%s%s%s%n%s", w1, w2, w3, &w4pos, w4)) < 3) { - continue; + if ((count = sscanf(line, "%[^\t\n]\t%[^\t\n]\t%[^\t\n]\t%n%[^\n]", w1, w2, w3, &w4pos, w4)) < 3) + { + if ((count = sscanf(line, "%s %s %[^\t]\t %n%[^\n]", w1, w2, w3, &w4pos, w4)) == 4 || + (count = sscanf(line, "%s %s %s %n%[^\n]\n", w1, w2, w3, &w4pos, w4)) >= 3) + { + ShowWarning("\r"); + ShowWarning("Incorrect separator syntax in file '%s', line '%i'. Use tabs instead of spaces!\n * %s %s %s %s\n",current_file,lines,w1,w2,w3,w4); + } else { + ShowError("\r"); //Erase the npc spinner. + ShowError("Could not parse file '%s', line '%i'.\n * %s %s %s %s\n",current_file,lines,w1,w2,w3,w4); + continue; + } } + // マップの存在確認 if (strcmp(w1,"-") !=0 && strcmpi(w1,"function") != 0 ){ sscanf(w1,"%[^,]",mapname); @@ -2689,7 +2690,7 @@ void npc_parsesrcfile (char *name) } else if (strcmpi(w2,"setcell") == 0 && count >= 3) { npc_parse_mapcell(w1,w2,w3,w4); } else { - ShowError("Probably TAB is missing: %s %s %s %s line '%i', file '%s'\n",w1,w2,w3,w4,lines,current_file); //Lupus + ShowError("Probably TAB is missing in file '%s', line '%i':\n * %s %s %s %s\n",current_file,lines,w1,w2,w3,w4); } } fclose(fp);