summaryrefslogtreecommitdiff
path: root/src/newgrf_gui.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-02-24 16:34:37 +0000
committermaedhros <maedhros@openttd.org>2007-02-24 16:34:37 +0000
commit8b6350d3a337739d2939685f4b9a9310ef5f0eaf (patch)
tree774677fb220475a45680ff648e10dfca1176faa2 /src/newgrf_gui.cpp
parent8ac0e7be21cb9bcbd0e3da6d5d4cf0159ff1b847 (diff)
downloadopenttd-8b6350d3a337739d2939685f4b9a9310ef5f0eaf.tar.xz
(svn r8881) -Feature: Allow built-in newgrf error messages to be translated, and load custom error messages properly.
Diffstat (limited to 'src/newgrf_gui.cpp')
-rw-r--r--src/newgrf_gui.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index c418786b2..6d5a78b89 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -11,6 +11,7 @@
#include "table/sprites.h"
#include "newgrf.h"
#include "newgrf_config.h"
+#include "strings.h"
#include "helpers.hpp"
@@ -44,8 +45,22 @@ static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, bool show
char buff[256];
if (c->error != NULL) {
- SetDParamStr(0, c->error);
- y += DrawStringMultiLine(x, y, STR_NEWGRF_ERROR_MSG, w);
+ SetDParamStr(0, c->filename);
+ SetDParam(1, 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(2 + i, param);
+ }
+
+ char message[512];
+ GetString(message, c->error->message, lastof(message));
+
+ SetDParamStr(0, message);
+ y += DrawStringMultiLine(x, y, c->error->severity, w);
}
/* Draw filename or not if it is not known (GRF sent over internet) */