From 8b6350d3a337739d2939685f4b9a9310ef5f0eaf Mon Sep 17 00:00:00 2001 From: maedhros Date: Sat, 24 Feb 2007 16:34:37 +0000 Subject: (svn r8881) -Feature: Allow built-in newgrf error messages to be translated, and load custom error messages properly. --- src/newgrf_gui.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/newgrf_gui.cpp') 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) */ -- cgit v1.2.3-54-g00ecf