summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-01-15 17:33:35 +0000
committerfrosch <frosch@openttd.org>2012-01-15 17:33:35 +0000
commit92700c12625e273297ac5f3e3e870b9ed5d047ab (patch)
tree6a9b0c7d2032f822d9259b87919cbec7f0b03b40 /src
parent1dc8de17e061dc7d076fb4ae9c1248277937fce8 (diff)
downloadopenttd-92700c12625e273297ac5f3e3e870b9ed5d047ab.tar.xz
(svn r23807) -Codechange: GRFError::num_params is not needed, remove it.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp4
-rw-r--r--src/newgrf_config.cpp3
-rw-r--r--src/newgrf_config.h1
-rw-r--r--src/newgrf_gui.cpp4
4 files changed, 4 insertions, 8 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index b9e110639..40e074da5 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -6195,12 +6195,10 @@ static void GRFLoadError(ByteReader *buf)
}
/* Only two parameter numbers can be used in the string. */
- uint i = 0;
- for (; i < 2 && buf->HasData(); i++) {
+ for (uint i = 0; i < lengthof(error->param_value) && buf->HasData(); i++) {
uint param_number = buf->ReadByte();
error->param_value[i] = _cur.grffile->GetParam(param_number);
}
- error->num_params = i;
_cur.grfconfig->error = error;
}
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 9ce75b679..f644315f1 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -188,8 +188,7 @@ GRFError::GRFError(const GRFError &error) :
custom_message(error.custom_message),
data(error.data),
message(error.message),
- severity(error.severity),
- num_params(error.num_params)
+ severity(error.severity)
{
if (error.custom_message != NULL) this->custom_message = strdup(error.custom_message);
if (error.data != NULL) this->data = strdup(error.data);
diff --git a/src/newgrf_config.h b/src/newgrf_config.h
index 432f6679d..a7c7da2ad 100644
--- a/src/newgrf_config.h
+++ b/src/newgrf_config.h
@@ -107,7 +107,6 @@ struct GRFError : ZeroedMemoryAllocator {
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 message and custom_message (0, 1 or 2)
uint32 param_value[2]; ///< Values of GRF parameters to show for message and custom_message
};
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index debda8965..ed3dbe6cc 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -50,7 +50,7 @@ void ShowNewGRFError()
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++) {
+ for (uint i = 0; i < lengthof(c->error->param_value); i++) {
SetDParam(6 + i, c->error->param_value[i]);
}
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);
SetDParam (3, STR_JUST_RAW_STRING);
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]);
}
GetString(message, c->error->custom_message == NULL ? c->error->message : STR_JUST_RAW_STRING, lastof(message));