(svn r23807) -Codechange: GRFError::num_params is not needed, remove it.

pull/155/head
frosch 13 years ago
parent 639395d007
commit 9eebe8b1ae

@ -6195,12 +6195,10 @@ static void GRFLoadError(ByteReader *buf)
} }
/* Only two parameter numbers can be used in the string. */ /* Only two parameter numbers can be used in the string. */
uint i = 0; for (uint i = 0; i < lengthof(error->param_value) && buf->HasData(); i++) {
for (; i < 2 && buf->HasData(); i++) {
uint param_number = buf->ReadByte(); uint param_number = buf->ReadByte();
error->param_value[i] = _cur.grffile->GetParam(param_number); error->param_value[i] = _cur.grffile->GetParam(param_number);
} }
error->num_params = i;
_cur.grfconfig->error = error; _cur.grfconfig->error = error;
} }

@ -188,8 +188,7 @@ GRFError::GRFError(const GRFError &error) :
custom_message(error.custom_message), custom_message(error.custom_message),
data(error.data), data(error.data),
message(error.message), message(error.message),
severity(error.severity), severity(error.severity)
num_params(error.num_params)
{ {
if (error.custom_message != NULL) this->custom_message = strdup(error.custom_message); if (error.custom_message != NULL) this->custom_message = strdup(error.custom_message);
if (error.data != NULL) this->data = strdup(error.data); if (error.data != NULL) this->data = strdup(error.data);

@ -107,7 +107,6 @@ struct GRFError : ZeroedMemoryAllocator {
char *data; ///< Additional data for message and custom_message char *data; ///< Additional data for message and custom_message
StringID message; ///< Default message StringID message; ///< Default message
StringID severity; ///< Info / Warning / Error / Fatal StringID severity; ///< Info / Warning / Error / Fatal
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 uint32 param_value[2]; ///< Values of GRF parameters to show for message and custom_message
}; };

@ -50,7 +50,7 @@ void ShowNewGRFError()
SetDParamStr(3, c->filename); SetDParamStr(3, c->filename);
SetDParam (4, STR_JUST_RAW_STRING); SetDParam (4, STR_JUST_RAW_STRING);
SetDParamStr(5, c->error->data); SetDParamStr(5, c->error->data);
for (uint i = 0; i < c->error->num_params; i++) { for (uint i = 0; i < lengthof(c->error->param_value); i++) {
SetDParam(6 + i, c->error->param_value[i]); SetDParam(6 + i, c->error->param_value[i]);
} }
ShowErrorMessage(STR_NEWGRF_ERROR_FATAL_POPUP, INVALID_STRING_ID, WL_CRITICAL); ShowErrorMessage(STR_NEWGRF_ERROR_FATAL_POPUP, INVALID_STRING_ID, WL_CRITICAL);
@ -67,7 +67,7 @@ static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint right, uint
SetDParamStr(2, c->filename); SetDParamStr(2, c->filename);
SetDParam (3, STR_JUST_RAW_STRING); SetDParam (3, STR_JUST_RAW_STRING);
SetDParamStr(4, c->error->data); SetDParamStr(4, c->error->data);
for (uint i = 0; i < c->error->num_params; i++) { for (uint i = 0; i < lengthof(c->error->param_value); i++) {
SetDParam(5 + i, c->error->param_value[i]); SetDParam(5 + i, c->error->param_value[i]);
} }
GetString(message, c->error->custom_message == NULL ? c->error->message : STR_JUST_RAW_STRING, lastof(message)); GetString(message, c->error->custom_message == NULL ? c->error->message : STR_JUST_RAW_STRING, lastof(message));

Loading…
Cancel
Save