mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-07-17 17:35:19 +01:00
(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;
|
char *end;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
while (*p == ' ' || *p == ',') p++;
|
||||||
|
if (*p == '\0') break;
|
||||||
v = strtol(p, &end, 0);
|
v = strtol(p, &end, 0);
|
||||||
if (p == end || n == maxitems) return -1;
|
if (p == end || n == maxitems) return -1;
|
||||||
p = end;
|
p = end;
|
||||||
items[n++] = v;
|
items[n++] = v;
|
||||||
if (*p == '\0') break;
|
|
||||||
if (*p != ',' && *p != ' ') return -1;
|
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
Loading…
Reference in New Issue
Block a user