summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-05-24 12:49:27 +0000
committeralberth <alberth@openttd.org>2009-05-24 12:49:27 +0000
commitbc9c2e43fe439bea31ea2a76c53d7fb16b1aa148 (patch)
tree1316fa595d6a7dbd0e15876c96ca8bebba383dba
parent855edb0839c27640ed7cdfd37006f185395ffec6 (diff)
downloadopenttd-bc9c2e43fe439bea31ea2a76c53d7fb16b1aa148.tar.xz
(svn r16413) -Codechange: Allow leading/trailing whitespace and comma in newgrf parameters instead of treating them as invalid.
-rw-r--r--src/newgrf_gui.cpp5
1 files 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;