changeset 12007:f136bdca8b9e draft

(svn r16413) -Codechange: Allow leading/trailing whitespace and comma in newgrf parameters instead of treating them as invalid.
author alberth <alberth@openttd.org>
date Sun, 24 May 2009 12:49:27 +0000
parents 6a32d73fd4be
children 066420f32d18
files src/newgrf_gui.cpp
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -32,13 +32,12 @@
 	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;