48 static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, uint bottom, bool show_params) |
48 static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, uint bottom, bool show_params) |
49 { |
49 { |
50 char buff[256]; |
50 char buff[256]; |
51 |
51 |
52 if (c->error != NULL) { |
52 if (c->error != NULL) { |
53 SetDParamStr(0, c->filename); |
|
54 SetDParamStr(1, c->error->data); |
|
55 for (uint i = 0; i < c->error->num_params; i++) { |
|
56 uint32 param = 0; |
|
57 byte param_number = c->error->param_number[i]; |
|
58 |
|
59 if (param_number < c->num_params) param = c->param[param_number]; |
|
60 |
|
61 SetDParam(2 + i, param); |
|
62 } |
|
63 |
|
64 char message[512]; |
53 char message[512]; |
65 GetString(message, c->error->custom_message != NULL ? BindCString(c->error->custom_message) : c->error->message, lastof(message)); |
54 if (c->error->custom_message == NULL) { |
|
55 SetDParamStr(0, c->filename); |
|
56 SetDParamStr(1, c->error->data); |
|
57 for (uint i = 0; i < c->error->num_params; i++) { |
|
58 uint32 param = 0; |
|
59 byte param_number = c->error->param_number[i]; |
|
60 |
|
61 if (param_number < c->num_params) param = c->param[param_number]; |
|
62 |
|
63 SetDParam(2 + i, param); |
|
64 } |
|
65 |
|
66 GetString(message, c->error->message, lastof(message)); |
|
67 } else { |
|
68 SetDParamStr(0, c->error->custom_message); |
|
69 GetString(message, STR_JUST_RAW_STRING, lastof(message)); |
|
70 } |
66 |
71 |
67 SetDParamStr(0, message); |
72 SetDParamStr(0, message); |
68 y += DrawStringMultiLine(x, y, c->error->severity, w, bottom - y); |
73 y += DrawStringMultiLine(x, y, c->error->severity, w, bottom - y); |
69 } |
74 } |
70 |
75 |
86 |
91 |
87 /* Show GRF parameter list */ |
92 /* Show GRF parameter list */ |
88 if (show_params) { |
93 if (show_params) { |
89 if (c->num_params > 0) { |
94 if (c->num_params > 0) { |
90 GRFBuildParamList(buff, c, lastof(buff)); |
95 GRFBuildParamList(buff, c, lastof(buff)); |
91 SetDParamStr(0, buff); |
96 SetDParam(0, STR_JUST_RAW_STRING); |
|
97 SetDParamStr(1, buff); |
92 } else { |
98 } else { |
93 SetDParam(0, STR_01A9_NONE); |
99 SetDParam(0, STR_01A9_NONE); |
94 } |
100 } |
95 y += DrawStringMultiLine(x, y, STR_NEWGRF_PARAMETER, w, bottom - y); |
101 y += DrawStringMultiLine(x, y, STR_NEWGRF_PARAMETER, w, bottom - y); |
96 } |
102 } |
100 if (c->status == GCS_DISABLED) y += DrawStringMultiLine(x, y, STR_NEWGRF_DISABLED, w, bottom - y); |
106 if (c->status == GCS_DISABLED) y += DrawStringMultiLine(x, y, STR_NEWGRF_DISABLED, w, bottom - y); |
101 if (HasBit(c->flags, GCF_COMPATIBLE)) y += DrawStringMultiLine(x, y, STR_NEWGRF_COMPATIBLE_LOADED, w, bottom - y); |
107 if (HasBit(c->flags, GCF_COMPATIBLE)) y += DrawStringMultiLine(x, y, STR_NEWGRF_COMPATIBLE_LOADED, w, bottom - y); |
102 |
108 |
103 /* Draw GRF info if it exists */ |
109 /* Draw GRF info if it exists */ |
104 if (c->info != NULL && !StrEmpty(c->info)) { |
110 if (c->info != NULL && !StrEmpty(c->info)) { |
105 SetDParamStr(0, c->info); |
111 SetDParam(0, STR_JUST_RAW_STRING); |
|
112 SetDParamStr(1, c->info); |
106 y += DrawStringMultiLine(x, y, STR_02BD, w, bottom - y); |
113 y += DrawStringMultiLine(x, y, STR_02BD, w, bottom - y); |
107 } else { |
114 } else { |
108 y += DrawStringMultiLine(x, y, STR_NEWGRF_NO_INFO, w, bottom - y); |
115 y += DrawStringMultiLine(x, y, STR_NEWGRF_NO_INFO, w, bottom - y); |
109 } |
116 } |
110 } |
117 } |
485 break; |
492 break; |
486 |
493 |
487 case SNGRFS_SET_PARAMETERS: { // Edit parameters |
494 case SNGRFS_SET_PARAMETERS: { // Edit parameters |
488 if (this->sel == NULL) break; |
495 if (this->sel == NULL) break; |
489 |
496 |
490 char buff[512]; |
497 static char buff[512]; |
491 GRFBuildParamList(buff, this->sel, lastof(buff)); |
498 GRFBuildParamList(buff, this->sel, lastof(buff)); |
492 ShowQueryString(BindCString(buff), STR_NEWGRF_PARAMETER_QUERY, 63, 250, this, CS_ALPHANUMERAL); |
499 SetDParamStr(0, buff); |
|
500 ShowQueryString(STR_JUST_RAW_STRING, STR_NEWGRF_PARAMETER_QUERY, 63, 250, this, CS_ALPHANUMERAL); |
493 break; |
501 break; |
494 } |
502 } |
495 } |
503 } |
496 } |
504 } |
497 |
505 |