From 105c7455aea5a8d3ec9729cd7f66077343e7134b Mon Sep 17 00:00:00 2001 From: maedhros Date: Tue, 12 Jun 2007 09:41:12 +0000 Subject: [PATCH] (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 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 6241d679d5..549981db51 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4398,6 +4398,16 @@ static void ResetNewGRF() _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 @@ static void ResetNewGRFData() /* Reset NewGRF files */ ResetNewGRF(); + /* Reset NewGRF errors. */ + ResetNewGRFErrors(); + /* Add engine type to engine data. This is needed for the refit precalculation. */ AddTypeToEngines();