(svn r23809) -Feature: Enhance some fatal NewGRF errors with the spritenumber that caused the problem.

This commit is contained in:
frosch 2012-01-15 18:18:44 +00:00
parent dfb5c78dc6
commit 64b6d03cd3
2 changed files with 12 additions and 9 deletions

View File

@ -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!

View File

@ -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;
}
}
}