(svn r10110) -Fix: Reset NewGRF errors along with all the other NewGRF data so that errors get loaded again when pressing "Apply".
authormaedhros
Tue, 12 Jun 2007 09:41:12 +0000
changeset 7366 3a76f142e0ab
parent 7365 d484a635f91d
child 7367 a0499d5cb8e5
(svn r10110) -Fix: Reset NewGRF errors along with all the other NewGRF data so that errors get loaded again when pressing "Apply".
src/newgrf.cpp
--- a/src/newgrf.cpp	Tue Jun 12 09:40:50 2007 +0000
+++ b/src/newgrf.cpp	Tue Jun 12 09:41:12 2007 +0000
@@ -4398,6 +4398,16 @@
 	_cur_grffile   = NULL;
 }
 
+static void ResetNewGRFErrors()
+{
+	for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
+		if (!HASBIT(c->flags, GCF_COPY) && c->error != NULL) {
+			free(c->error);
+			c->error = NULL;
+		}
+	}
+}
+
 /**
  * Reset all NewGRF loaded data
  * TODO
@@ -4465,6 +4475,9 @@
 	/* Reset NewGRF files */
 	ResetNewGRF();
 
+	/* Reset NewGRF errors. */
+	ResetNewGRFErrors();
+
 	/* Add engine type to engine data. This is needed for the refit precalculation. */
 	AddTypeToEngines();