From c09873681687172583bda5e92c4f5c53d141a0d2 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Thu, 26 Oct 2006 19:16:10 +0000 Subject: (svn r6948) - Codechange: Clear out all NewGRF file data before loading files again --- newgrf.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'newgrf.c') diff --git a/newgrf.c b/newgrf.c index 2805531e6..6f16c9e3b 100644 --- a/newgrf.c +++ b/newgrf.c @@ -3068,6 +3068,21 @@ static void ResetCustomStations(void) } } +static void ResetNewGRF(void) +{ + GRFFile *f, *next; + + for (f = _first_grffile; f != NULL; f = next) { + next = f->next; + + free(f->filename); + free(f); + } + + _first_grffile = NULL; + _cur_grffile = NULL; +} + /** * Reset all NewGRF loaded data * TODO @@ -3118,6 +3133,9 @@ static void ResetNewGRFData(void) ResetStationClasses(); ResetCustomStations(); + /* Reset NewGRF files */ + ResetNewGRF(); + // Add engine type to engine data. This is needed for the refit precalculation. AddTypeToEngines(); -- cgit v1.2.3-70-g09d2