From ddd47a056d9abc2760181dd4083b605164e6b4cb Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 4 May 2009 11:23:21 +0000 Subject: [PATCH] (svn r16223) -Fix (r8881): ActionB should use the online parameters from GRFFile instead of the initial user-specified values from GRFConfig. Also use the values as they were set when the ActionB was executed, not as they are set when the message is shown. --- src/newgrf.cpp | 3 ++- src/newgrf_config.h | 4 ++-- src/newgrf_gui.cpp | 7 +------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 6ed173463f..508e8305c5 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4381,7 +4381,8 @@ static void GRFLoadError(byte *buf, size_t len) /* Only two parameter numbers can be used in the string. */ uint i = 0; for (; i < 2 && len > 0; i++) { - error->param_number[i] = grf_load_byte(&buf); + uint param_number = grf_load_byte(&buf); + error->param_value[i] = (param_number < _cur_grffile->param_end ? _cur_grffile->param[param_number] : 0); len--; } error->num_params = i; diff --git a/src/newgrf_config.h b/src/newgrf_config.h index aba8dc330d..9f0e7efd54 100644 --- a/src/newgrf_config.h +++ b/src/newgrf_config.h @@ -53,8 +53,8 @@ struct GRFError { char *data; ///< Additional data for message and custom_message StringID message; ///< Default message StringID severity; ///< Info / Warning / Error / Fatal - uint8 num_params; ///< Number of additinal parameters for custom_message (0, 1 or 2) - uint8 param_number[2]; ///< GRF parameters to show for custom_message + uint8 num_params; ///< Number of additinal parameters for message and custom_message (0, 1 or 2) + uint32 param_value[2]; ///< Values of GRF parameters to show for message and custom_message }; /** Information about GRF, used in the game and (part of it) in savegames */ diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 5a1223ebf5..485464e536 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -57,12 +57,7 @@ static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, uint bott SetDParam (3, STR_JUST_RAW_STRING); SetDParamStr(4, c->error->data); for (uint i = 0; i < c->error->num_params; i++) { - uint32 param = 0; - byte param_number = c->error->param_number[i]; - - if (param_number < c->num_params) param = c->param[param_number]; - - SetDParam(5 + i, param); + SetDParam(5 + i, c->error->param_value[i]); } GetString(message, c->error->custom_message == NULL ? c->error->message : STR_JUST_RAW_STRING, lastof(message));