(svn r16413) -Codechange: Allow leading/trailing whitespace and comma in newgrf parameters instead of treating them as invalid.

This commit is contained in:
alberth 2009-05-24 12:49:27 +00:00
parent 855edb0839
commit bc9c2e43fe
1 changed files with 2 additions and 3 deletions

View File

@ -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;