From 64b6d03cd36746aaa6d5943ceaebdf53d3f42226 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 15 Jan 2012 18:18:44 +0000 Subject: (svn r23809) -Feature: Enhance some fatal NewGRF errors with the spritenumber that caused the problem. --- src/lang/english.txt | 14 +++++++------- src/newgrf.cpp | 7 +++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index b0e15443c..9d94104d0 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2540,16 +2540,16 @@ STR_NEWGRF_ERROR_OTTD_VERSION_NUMBER :{1:STRING1} req 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 {2:RAW_STRING} as static NewGRF with {4:RAW_STRING} could cause desyncs -STR_NEWGRF_ERROR_UNEXPECTED_SPRITE :Unexpected sprite -STR_NEWGRF_ERROR_UNKNOWN_PROPERTY :Unknown Action 0 property -STR_NEWGRF_ERROR_INVALID_ID :Attempt to use invalid ID +STR_NEWGRF_ERROR_UNEXPECTED_SPRITE :Unexpected sprite (sprite {5:NUM}) +STR_NEWGRF_ERROR_UNKNOWN_PROPERTY :Unknown Action 0 property {6:HEX} (sprite {5:NUM}) +STR_NEWGRF_ERROR_INVALID_ID :Attempt to use invalid ID (sprite {5:NUM}) STR_NEWGRF_ERROR_CORRUPT_SPRITE :{YELLOW}{RAW_STRING} contains a corrupt sprite. All corrupt sprites will be shown as a red question mark (?) -STR_NEWGRF_ERROR_MULTIPLE_ACTION_8 :Contains multiple Action 8 entries -STR_NEWGRF_ERROR_READ_BOUNDS :Read past end of pseudo-sprite +STR_NEWGRF_ERROR_MULTIPLE_ACTION_8 :Contains multiple Action 8 entries (sprite {5:NUM}) +STR_NEWGRF_ERROR_READ_BOUNDS :Read past end of pseudo-sprite (sprite {5:NUM}) STR_NEWGRF_ERROR_MISSING_SPRITES :{WHITE}The currently used base graphics set is missing a number of sprites.{}Please update the base graphics set -STR_NEWGRF_ERROR_GRM_FAILED :Requested GRF resources not available +STR_NEWGRF_ERROR_GRM_FAILED :Requested GRF resources not available (sprite {5:NUM}) STR_NEWGRF_ERROR_FORCEFULLY_DISABLED :{2:RAW_STRING} was disabled by {4:RAW_STRING} -STR_NEWGRF_ERROR_INVALID_SPRITE_LAYOUT :Invalid/unknown sprite layout format +STR_NEWGRF_ERROR_INVALID_SPRITE_LAYOUT :Invalid/unknown sprite layout format (sprite {5:NUM}) # NewGRF related 'general' warnings STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}Caution! diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 40e074da5..9504220df 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -418,6 +418,7 @@ static GRFError *DisableGrf(StringID message = STR_NULL, GRFConfig *config = NUL if (message != STR_NULL) { delete config->error; config->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, message); + if (config == _cur.grfconfig) config->error->param_value[0] = _cur.nfo_line; } return config->error; @@ -4160,10 +4161,12 @@ static bool HandleChangeInfoResult(const char *caller, ChangeInfoResult cir, uin grfmsg(0, "%s: Unknown property 0x%02X of feature 0x%02X, disabling", caller, property, feature); /* FALL THROUGH */ - case CIR_INVALID_ID: + case CIR_INVALID_ID: { /* No debug message for an invalid ID, as it has already been output */ - DisableGrf(cir == CIR_INVALID_ID ? STR_NEWGRF_ERROR_INVALID_ID : STR_NEWGRF_ERROR_UNKNOWN_PROPERTY); + GRFError *error = DisableGrf(cir == CIR_INVALID_ID ? STR_NEWGRF_ERROR_INVALID_ID : STR_NEWGRF_ERROR_UNKNOWN_PROPERTY); + if (cir != CIR_INVALID_ID) error->param_value[1] = property; return true; + } } } -- cgit v1.2.3-70-g09d2