src/newgrf_gui.cpp
changeset 6465 dddb39b41ee0
parent 6429 02c062eb2c74
child 6489 4c7f9972d879
equal deleted inserted replaced
6464:1c3515433409 6465:dddb39b41ee0
     9 #include "window.h"
     9 #include "window.h"
    10 #include "table/strings.h"
    10 #include "table/strings.h"
    11 #include "table/sprites.h"
    11 #include "table/sprites.h"
    12 #include "newgrf.h"
    12 #include "newgrf.h"
    13 #include "newgrf_config.h"
    13 #include "newgrf_config.h"
       
    14 #include "strings.h"
    14 #include "helpers.hpp"
    15 #include "helpers.hpp"
    15 
    16 
    16 
    17 
    17 /** Parse an integerlist string and set each found value
    18 /** Parse an integerlist string and set each found value
    18  * @param p the string to be parsed. Each element in the list is seperated by a
    19  * @param p the string to be parsed. Each element in the list is seperated by a
    42 static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, bool show_params)
    43 static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, bool show_params)
    43 {
    44 {
    44 	char buff[256];
    45 	char buff[256];
    45 
    46 
    46 	if (c->error != NULL) {
    47 	if (c->error != NULL) {
    47 		SetDParamStr(0, c->error);
    48 		SetDParamStr(0, c->filename);
    48 		y += DrawStringMultiLine(x, y, STR_NEWGRF_ERROR_MSG, w);
    49 		SetDParam(1, c->error->data);
       
    50 		for (uint i = 0; i < c->error->num_params; i++) {
       
    51 			uint32 param = 0;
       
    52 			byte param_number = c->error->param_number[i];
       
    53 
       
    54 			if (param_number < c->num_params) param = c->param[param_number];
       
    55 
       
    56 			SetDParam(2 + i, param);
       
    57 		}
       
    58 
       
    59 		char message[512];
       
    60 		GetString(message, c->error->message, lastof(message));
       
    61 
       
    62 		SetDParamStr(0, message);
       
    63 		y += DrawStringMultiLine(x, y, c->error->severity, w);
    49 	}
    64 	}
    50 
    65 
    51 	/* Draw filename or not if it is not known (GRF sent over internet) */
    66 	/* Draw filename or not if it is not known (GRF sent over internet) */
    52 	if (c->filename != NULL) {
    67 	if (c->filename != NULL) {
    53 		SetDParamStr(0, c->filename);
    68 		SetDParamStr(0, c->filename);