From f12498b633d14ee2c5b6766bf6af9c37ad84c958 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Tue, 7 Feb 2023 15:13:32 -0500 Subject: [PATCH] Add: Show NewGRF name in NewGRF-created errors (#10457) --- src/lang/english.txt | 4 ++-- src/newgrf_gui.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index 732f3a6745..4a9786b53a 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3352,8 +3352,8 @@ STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{RAW_ST STR_NEWGRF_ERROR_MSG_WARNING :{RED}Warning: {SILVER}{RAW_STRING} STR_NEWGRF_ERROR_MSG_ERROR :{RED}Error: {SILVER}{RAW_STRING} STR_NEWGRF_ERROR_MSG_FATAL :{RED}Fatal: {SILVER}{RAW_STRING} -STR_NEWGRF_ERROR_FATAL_POPUP :{WHITE}A fatal NewGRF error has occurred: {}{STRING5} -STR_NEWGRF_ERROR_POPUP :{WHITE}A NewGRF error has occurred: {}{STRING5} +STR_NEWGRF_ERROR_FATAL_POPUP :{WHITE}The NewGRF "{RAW_STRING}" has returned a fatal error: {}{STRING5} +STR_NEWGRF_ERROR_POPUP :{WHITE}The NewGRF "{RAW_STRING}" has returned an error: {}{STRING5} STR_NEWGRF_ERROR_VERSION_NUMBER :{1:RAW_STRING} will not work with the TTDPatch version reported by OpenTTD STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{1:RAW_STRING} is for the {2:RAW_STRING} version of TTD STR_NEWGRF_ERROR_UNSET_SWITCH :{1:RAW_STRING} is designed to be used with {2:RAW_STRING} diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index d4f8a8996d..bb671f1e2a 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -50,12 +50,13 @@ void ShowNewGRFError() /* Only show Fatal and Error level messages */ if (c->error == nullptr || (c->error->severity != STR_NEWGRF_ERROR_MSG_FATAL && c->error->severity != STR_NEWGRF_ERROR_MSG_ERROR)) continue; - SetDParam (0, c->error->message != STR_NULL ? c->error->message : STR_JUST_RAW_STRING); - SetDParamStr(1, c->error->custom_message); - SetDParamStr(2, c->filename); - SetDParamStr(3, c->error->data); + SetDParamStr(0, c->GetName()); + SetDParam (1, c->error->message != STR_NULL ? c->error->message : STR_JUST_RAW_STRING); + SetDParamStr(2, c->error->custom_message); + SetDParamStr(3, c->filename); + SetDParamStr(4, c->error->data); for (uint i = 0; i < lengthof(c->error->param_value); i++) { - SetDParam(4 + i, c->error->param_value[i]); + SetDParam(5 + i, c->error->param_value[i]); } if (c->error->severity == STR_NEWGRF_ERROR_MSG_FATAL) { ShowErrorMessage(STR_NEWGRF_ERROR_FATAL_POPUP, INVALID_STRING_ID, WL_CRITICAL);