From 7b0ea17f00e69cd93eb583e24a66abeb74e8b5bc Mon Sep 17 00:00:00 2001 From: frosch Date: Thu, 12 Jan 2012 17:46:42 +0000 Subject: [PATCH] (svn r23789) -Fix: [NewGRF] While we can only show one error per NewGRF, fatal errors should always disable the GRF. Also give those errors precedence over other information. --- src/newgrf.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 0e10667e8d..b9e110639a 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -6128,9 +6128,6 @@ static void GRFLoadError(ByteReader *buf) STR_NEWGRF_ERROR_MSG_FATAL }; - /* For now we can only show one message per newgrf file. */ - if (_cur.grfconfig->error != NULL) return; - byte severity = buf->ReadByte(); byte lang = buf->ReadByte(); byte message_id = buf->ReadByte(); @@ -6153,6 +6150,10 @@ static void GRFLoadError(ByteReader *buf) /* This is a fatal error, so make sure the GRF is deactivated and no * more of it gets loaded. */ DisableGrf(); + + /* Make sure we show fatal errors, instead of silly infos from before */ + delete _cur.grfconfig->error; + _cur.grfconfig->error = NULL; } if (message_id >= lengthof(msgstr) && message_id != 0xFF) { @@ -6165,6 +6166,9 @@ static void GRFLoadError(ByteReader *buf) return; } + /* For now we can only show one message per newgrf file. */ + if (_cur.grfconfig->error != NULL) return; + GRFError *error = new GRFError(sevstr[severity]); if (message_id == 0xFF) {