summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-01-12 17:46:42 +0000
committerfrosch <frosch@openttd.org>2012-01-12 17:46:42 +0000
commit7b0ea17f00e69cd93eb583e24a66abeb74e8b5bc (patch)
treea374bd920c85687b95d3c4ef1ef37d4e8eb999a6 /src/newgrf.cpp
parentec54f39db51841b2e05426e6c5951cf00ab9723d (diff)
downloadopenttd-7b0ea17f00e69cd93eb583e24a66abeb74e8b5bc.tar.xz
(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.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 0e10667e8..b9e110639 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) {