(svn r3827) Remove the global variable _error_message_2, it's only used as local variable
authortron
Sun, 12 Mar 2006 10:15:36 +0000
changeset 3182 0f1161388ea1
parent 3181 58fb7ebd7de1
child 3183 cf71bd234ebd
(svn r3827) Remove the global variable _error_message_2, it's only used as local variable
command.c
main_gui.c
variables.h
--- a/command.c	Sun Mar 12 08:47:18 2006 +0000
+++ b/command.c	Sun Mar 12 10:15:36 2006 +0000
@@ -399,6 +399,7 @@
 	CommandProc *proc;
 	uint32 flags;
 	bool notest;
+	StringID error_part1;
 
 	int x = TileX(tile) * 16;
 	int y = TileY(tile) * 16;
@@ -412,13 +413,13 @@
 	assert(_docommand_recursive == 0);
 
 	_error_message = INVALID_STRING_ID;
-	_error_message_2 = cmd >> 16;
+	error_part1 = GB(cmd, 16, 16);
 	_additional_cash_required = 0;
 
 	/** Spectator has no rights except for the dedicated server which
 	 * is a spectator but is the server, so can do anything */
 	if (_current_player == OWNER_SPECTATOR && !_network_dedicated) {
-		ShowErrorMessage(_error_message, _error_message_2, x, y);
+		ShowErrorMessage(_error_message, error_part1, x, y);
 		_cmd_text = NULL;
 		return false;
 	}
@@ -459,7 +460,7 @@
 		res = proc(x, y, flags, p1, p2);
 		if (CmdFailed(res)) {
 			if (res & 0xFFFF) _error_message = res & 0xFFFF;
-			ShowErrorMessage(_error_message, _error_message_2, x, y);
+			ShowErrorMessage(_error_message, error_part1, x, y);
 		} else {
 			ShowEstimatedCostOrIncome(res, x, y);
 		}
@@ -524,7 +525,7 @@
 			ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
 		if (_additional_cash_required) {
 			SetDParam(0, _additional_cash_required);
-			ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, _error_message_2, x,y);
+			ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x,y);
 			if (res2 == 0) goto callb_err;
 		}
 	}
@@ -537,8 +538,9 @@
 
 show_error:
 	// show error message if the command fails?
-	if (IsLocalPlayer() && _error_message_2 != 0)
-		ShowErrorMessage(_error_message, _error_message_2, x,y);
+	if (IsLocalPlayer() && error_part1 != 0) {
+		ShowErrorMessage(_error_message, error_part1, x,y);
+	}
 
 callb_err:
 	_docommand_recursive = 0;
--- a/main_gui.c	Sun Mar 12 08:47:18 2006 +0000
+++ b/main_gui.c	Sun Mar 12 10:15:36 2006 +0000
@@ -1145,12 +1145,13 @@
 	int sizex, sizey;
 	byte h;
 
-	_error_message_2 = mode ? STR_0808_CAN_T_RAISE_LAND_HERE : STR_0809_CAN_T_LOWER_LAND_HERE;
-
 	_generating_world = true; // used to create green terraformed land
 
 	if (_terraform_size == 1) {
-		DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(_error_message_2));
+		StringID msg =
+			mode ? STR_0808_CAN_T_RAISE_LAND_HERE : STR_0809_CAN_T_LOWER_LAND_HERE;
+
+		DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(msg));
 	} else {
 		SndPlayTileFx(SND_1F_SPLAT, tile);
 
--- a/variables.h	Sun Mar 12 08:47:18 2006 +0000
+++ b/variables.h	Sun Mar 12 10:15:36 2006 +0000
@@ -269,7 +269,6 @@
 VARDEF byte _game_mode;
 
 VARDEF StringID _error_message;
-VARDEF StringID _error_message_2;
 VARDEF int32 _additional_cash_required;
 
 VARDEF uint32 _decode_parameters[20];