summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-01-15 18:18:44 +0000
committerfrosch <frosch@openttd.org>2012-01-15 18:18:44 +0000
commit64b6d03cd36746aaa6d5943ceaebdf53d3f42226 (patch)
tree44392305df939cc9662e462118f9235d7de652d8 /src
parentdfb5c78dc65e03b40a0a20f6f76ffb79cb40b6cc (diff)
downloadopenttd-64b6d03cd36746aaa6d5943ceaebdf53d3f42226.tar.xz
(svn r23809) -Feature: Enhance some fatal NewGRF errors with the spritenumber that caused the problem.
Diffstat (limited to 'src')
-rw-r--r--src/lang/english.txt14
-rw-r--r--src/newgrf.cpp7
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;
+ }
}
}