(svn r14112) -Fix (r13715)[FS#2232]: Action B custom messages with parameteers were broken.
authorfrosch
Wed, 20 Aug 2008 19:31:35 +0000
changeset 9957 eee22936a397
parent 9956 094d932dec8a
child 9958 2e95bc5107d1
(svn r14112) -Fix (r13715)[FS#2232]: Action B custom messages with parameteers were broken.
src/lang/english.txt
src/newgrf_gui.cpp
--- a/src/lang/english.txt	Wed Aug 20 19:10:42 2008 +0000
+++ b/src/lang/english.txt	Wed Aug 20 19:31:35 2008 +0000
@@ -3205,13 +3205,13 @@
 STR_NEWGRF_ERROR_MSG_WARNING                                    :{RED}Warning: {SILVER}{RAW_STRING}
 STR_NEWGRF_ERROR_MSG_ERROR                                      :{RED}Error: {SILVER}{RAW_STRING}
 STR_NEWGRF_ERROR_MSG_FATAL                                      :{RED}Fatal: {SILVER}{RAW_STRING}
-STR_NEWGRF_ERROR_VERSION_NUMBER                                 :{RAW_STRING} will not work with the TTDPatch version reported by OpenTTD.
-STR_NEWGRF_ERROR_DOS_OR_WINDOWS                                 :{RAW_STRING} is for the {RAW_STRING} version of TTD.
-STR_NEWGRF_ERROR_UNSET_SWITCH                                   :{RAW_STRING} is designed to be used with {RAW_STRING}
-STR_NEWGRF_ERROR_INVALID_PARAMETER                              :Invalid parameter for {RAW_STRING}: parameter {RAW_STRING} ({NUM})
-STR_NEWGRF_ERROR_LOAD_BEFORE                                    :{RAW_STRING} must be loaded before {RAW_STRING}.
-STR_NEWGRF_ERROR_LOAD_AFTER                                     :{RAW_STRING} must be loaded after {RAW_STRING}.
-STR_NEWGRF_ERROR_OTTD_VERSION_NUMBER                            :{RAW_STRING} requires OpenTTD version {RAW_STRING} or better.
+STR_NEWGRF_ERROR_VERSION_NUMBER                                 :{SKIP}{STRING1} will not work with the TTDPatch version reported by OpenTTD.
+STR_NEWGRF_ERROR_DOS_OR_WINDOWS                                 :{SKIP}{STRING1} is for the {STRING1} version of TTD.
+STR_NEWGRF_ERROR_UNSET_SWITCH                                   :{SKIP}{STRING1} is designed to be used with {STRING1}
+STR_NEWGRF_ERROR_INVALID_PARAMETER                              :{SKIP}Invalid parameter for {STRING1}: parameter {STRING1} ({NUM})
+STR_NEWGRF_ERROR_LOAD_BEFORE                                    :{SKIP}{STRING1} must be loaded before {STRING1}.
+STR_NEWGRF_ERROR_LOAD_AFTER                                     :{SKIP}{STRING1} must be loaded after {STRING1}.
+STR_NEWGRF_ERROR_OTTD_VERSION_NUMBER                            :{SKIP}{STRING1} requires OpenTTD version {STRING1} or better.
 STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE                          :the GRF file it was designed to translate
 STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED                        :Too many NewGRFs are loaded.
 STR_NEWGRF_ERROR_STATIC_GRF_CAUSES_DESYNC                       :Loading {RAW_STRING} as static NewGRF with {RAW_STRING} could cause desyncs.
--- a/src/newgrf_gui.cpp	Wed Aug 20 19:10:42 2008 +0000
+++ b/src/newgrf_gui.cpp	Wed Aug 20 19:31:35 2008 +0000
@@ -53,23 +53,20 @@
 
 	if (c->error != NULL) {
 		char message[512];
-		if (c->error->custom_message == NULL) {
-			SetDParamStr(0, c->filename);
-			SetDParamStr(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];
+		SetDParamStr(0, c->error->custom_message); // is skipped by built-in messages
+		SetDParam   (1, STR_JUST_RAW_STRING);
+		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++) {
+			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);
-			}
+			if (param_number < c->num_params) param = c->param[param_number];
 
-			GetString(message, c->error->message, lastof(message));
-		} else {
-			SetDParamStr(0, c->error->custom_message);
-			GetString(message, STR_JUST_RAW_STRING, lastof(message));
+			SetDParam(5 + i, param);
 		}
+		GetString(message, c->error->custom_message == NULL ? c->error->message : STR_JUST_RAW_STRING, lastof(message));
 
 		SetDParamStr(0, message);
 		y += DrawStringMultiLine(x, y, c->error->severity, w, bottom - y);