- Increased line buffer size when parsing scripts. Helps when trying to define pretty big shops.
- 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. git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9352 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
e3615a4cb5
commit
e23391b60d
@ -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]
|
||||
|
@ -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) {
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user