From 50d230a52f9827f43e58c61e2cafd880ceb29d19 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Fri, 29 Aug 2008 20:03:51 +0000 Subject: [PATCH] (svn r14184) -Codechange: [NewGRF] Since our NewGRF handling is better than it used to be, disable a NewGRF if unexpected sprites are reached. --- src/lang/english.txt | 1 + src/newgrf.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index d3ce0072ee..461eef9f39 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3216,6 +3216,7 @@ STR_NEWGRF_ERROR_OTTD_VERSION_NUMBER :{SKIP}{STRING1} STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :the GRF file it was designed to translate STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED :Too many NewGRFs are loaded. STR_NEWGRF_ERROR_STATIC_GRF_CAUSES_DESYNC :Loading {RAW_STRING} as static NewGRF with {RAW_STRING} could cause desyncs. +STR_NEWGRF_ERROR_UNEXPECTED_SPRITE :Unexpected sprite. STR_NEWGRF_PRESET_LIST_TIP :{BLACK}Load the selected preset STR_NEWGRF_PRESET_SAVE :{BLACK}Save preset diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 2fc15c06ab..35c604bb63 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -5918,7 +5918,14 @@ void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage) FioSkipBytes(num); } } else { - if (_skip_sprites == 0) grfmsg(7, "LoadNewGRFFile: Skipping unexpected sprite"); + if (_skip_sprites == 0) { + grfmsg(0, "LoadNewGRFFile: Unexpected sprite, disabling"); + config->status = GCS_DISABLED; + config->error = CallocT(1); + config->error->severity = STR_NEWGRF_ERROR_MSG_FATAL; + config->error->message = STR_NEWGRF_ERROR_UNEXPECTED_SPRITE; + break; + } FioSkipBytes(7); num -= 8;