From bc9c2e43fe439bea31ea2a76c53d7fb16b1aa148 Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 24 May 2009 12:49:27 +0000 Subject: (svn r16413) -Codechange: Allow leading/trailing whitespace and comma in newgrf parameters instead of treating them as invalid. --- src/newgrf_gui.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 47a5e91a8..deeb17f4a 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -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; -- cgit v1.2.3-70-g09d2