mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r16413) -Codechange: Allow leading/trailing whitespace and comma in newgrf parameters instead of treating them as invalid.
This commit is contained in:
parent
855edb0839
commit
bc9c2e43fe
|
@ -32,13 +32,12 @@ static int parse_intlist(const char *p, int *items, int maxitems)
|
|||
char *end;
|
||||
|
||||
for (;;) {
|
||||
while (*p == ' ' || *p == ',') p++;
|
||||
if (*p == '\0') break;
|
||||
v = strtol(p, &end, 0);
|
||||
if (p == end || n == maxitems) return -1;
|
||||
p = end;
|
||||
items[n++] = v;
|
||||
if (*p == '\0') break;
|
||||
if (*p != ',' && *p != ' ') return -1;
|
||||
p++;
|
||||
}
|
||||
|
||||
return n;
|
||||
|
|
Loading…
Reference in New Issue