diff options
author | rubidium <rubidium@openttd.org> | 2009-12-15 00:00:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-15 00:00:51 +0000 |
commit | 3e6c530e1ea1139d18ebe31fa6e99460cdfbce6e (patch) | |
tree | 7461637cdc7d48ef9c1e132200b58bdba076c1de /src/newgrf_gui.cpp | |
parent | 5450167efc292ab93ab841077e71a7d63cfc7e05 (diff) | |
download | openttd-3e6c530e1ea1139d18ebe31fa6e99460cdfbce6e.tar.xz |
(svn r18506) -Fix [FS#3368]: no error message was created for the first fatal NewGRF error.
Diffstat (limited to 'src/newgrf_gui.cpp')
-rw-r--r-- | src/newgrf_gui.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index c6fdf8450..1515e4ba5 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -26,6 +26,29 @@ #include "table/strings.h" #include "table/sprites.h" +/** + * Show the first NewGRF error we can find. + */ +void ShowNewGRFError() +{ + for (const GRFConfig *c = _grfconfig; c != NULL; c = c->next) { + /* We only want to show fatal errors */ + if (c->error == NULL || c->error->severity != STR_NEWGRF_ERROR_MSG_FATAL) continue; + + SetDParam (0, c->error->custom_message == NULL ? c->error->message : STR_JUST_RAW_STRING); + SetDParamStr(1, c->error->custom_message); + SetDParam (2, STR_JUST_RAW_STRING); + SetDParamStr(3, c->filename); + SetDParam (4, STR_JUST_RAW_STRING); + SetDParamStr(5, c->error->data); + for (uint i = 0; i < c->error->num_params; i++) { + SetDParam(6 + i, c->error->param_value[i]); + } + ShowErrorMessage(STR_NEWGRF_ERROR_FATAL_POPUP, INVALID_STRING_ID, 0, 0, true); + break; + } +} + /** Parse an integerlist string and set each found value * @param p the string to be parsed. Each element in the list is seperated by a * comma or a space character |