(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
authorrubidium
Thu, 21 Jun 2007 17:25:17 +0000
changeset 7002 1bf6a62b0fcb
parent 7001 4f0dae004e46
child 7003 378939545b54
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
-Fix: some displays of money were wrong.
src/aircraft_gui.cpp
src/bridge_gui.cpp
src/build_vehicle_gui.cpp
src/command.cpp
src/economy.cpp
src/engine_gui.cpp
src/graph_gui.cpp
src/group_gui.cpp
src/industry_gui.cpp
src/main_gui.cpp
src/misc_cmd.cpp
src/misc_gui.cpp
src/network/network_gui.cpp
src/openttd.h
src/player_gui.cpp
src/players.cpp
src/roadveh_gui.cpp
src/ship_gui.cpp
src/strings.cpp
src/town_gui.cpp
src/train_cmd.cpp
src/train_gui.cpp
src/tunnel_map.cpp
src/tunnel_map.h
src/tunnelbridge_cmd.cpp
src/variables.h
src/vehicle_gui.cpp
--- a/src/aircraft_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/aircraft_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -92,7 +92,7 @@
 
 			SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED);
 			SetDParam(2, v->max_age / 366);
-			SetDParamMoney(3, _price.aircraft_running * AircraftVehInfo(v->engine_type)->running_cost >> 8);
+			SetDParam(3, _price.aircraft_running * AircraftVehInfo(v->engine_type)->running_cost >> 8);
 			DrawString(2, 15, STR_A00D_AGE_RUNNING_COST_YR, 0);
 		}
 
@@ -104,8 +104,8 @@
 
 		/* Draw profit */
 		{
-			SetDParamMoney(0, v->profit_this_year);
-			SetDParamMoney(1, v->profit_last_year);
+			SetDParam(0, v->profit_this_year);
+			SetDParam(1, v->profit_last_year);
 			DrawString(2, 35, STR_A00F_PROFIT_THIS_YEAR_LAST_YEAR, 0);
 		}
 
@@ -125,7 +125,7 @@
 
 		/* Draw Transfer credits text */
 		{
-			SetDParamMoney(0, v->cargo_feeder_share);
+			SetDParam(0, v->cargo_feeder_share);
 			DrawString(60, 101, STR_FEEDER_CARGO_VALUE, 0);
 		}
 
@@ -139,7 +139,7 @@
 				if (IsNormalAircraft(v)) {
 					SetDParam(0, GetCustomEngineName(v->engine_type));
 					SetDParam(1, v->build_year);
-					SetDParamMoney(2, v->value);
+					SetDParam(2, v->value);
 					DrawString(60, y, STR_A011_BUILT_VALUE, 0);
 					y += 10;
 
--- a/src/bridge_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/bridge_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -47,7 +47,7 @@
 			for (uint i = 0; i < 4 && i + w->vscroll.pos < _bridgedata.count; i++) {
 				const Bridge *b = &_bridge[_bridgedata.indexes[i + w->vscroll.pos]];
 
-				SetDParamMoney(2, _bridgedata.costs[i + w->vscroll.pos]);
+				SetDParam(2, _bridgedata.costs[i + w->vscroll.pos]);
 				SetDParam(1, b->speed * 10 / 16);
 				SetDParam(0, b->material);
 				DrawSprite(b->sprite, b->pal, 3, 15 + i * 22);
--- a/src/build_vehicle_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/build_vehicle_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -434,7 +434,7 @@
 static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const RailVehicleInfo *rvi)
 {
 	/* Purchase cost */
-	SetDParamMoney(0, (GetEngineProperty(engine_number, 0x17, rvi->base_cost) * _price.build_railwagon) >> 8);
+	SetDParam(0, (GetEngineProperty(engine_number, 0x17, rvi->base_cost) * _price.build_railwagon) >> 8);
 	DrawString(x, y, STR_PURCHASE_INFO_COST, 0);
 	y += 10;
 
@@ -464,7 +464,7 @@
 	uint weight = GetEngineProperty(engine_number, 0x16, rvi->weight);
 
 	/* Purchase Cost - Engine weight */
-	SetDParamMoney(0, GetEngineProperty(engine_number, 0x17, rvi->base_cost) * (_price.build_railvehicle >> 3) >> 5);
+	SetDParam(0, GetEngineProperty(engine_number, 0x17, rvi->base_cost) * (_price.build_railvehicle >> 3) >> 5);
 	SetDParam(1, weight << multihead);
 	DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, 0);
 	y += 10;
@@ -483,7 +483,7 @@
 	}
 
 	/* Running cost */
-	SetDParamMoney(0, (GetEngineProperty(engine_number, 0x0D, rvi->running_cost_base) * _price.running_rail[rvi->running_cost_class] >> 8) << multihead);
+	SetDParam(0, (GetEngineProperty(engine_number, 0x0D, rvi->running_cost_base) * _price.running_rail[rvi->running_cost_class] >> 8) << multihead);
 	DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 	y += 10;
 
@@ -504,13 +504,13 @@
 	bool refittable = (_engine_info[engine_number].refit_mask != 0);
 
 	/* Purchase cost - Max speed */
-	SetDParamMoney(0, GetEngineProperty(engine_number, 0x11, rvi->base_cost) * (_price.roadveh_base >> 3) >> 5);
+	SetDParam(0, GetEngineProperty(engine_number, 0x11, rvi->base_cost) * (_price.roadveh_base >> 3) >> 5);
 	SetDParam(1, rvi->max_speed * 10 / 32);
 	DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
 	y += 10;
 
 	/* Running cost */
-	SetDParamMoney(0, rvi->running_cost * _price.roadveh_running >> 8);
+	SetDParam(0, rvi->running_cost * _price.roadveh_running >> 8);
 	DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 	y += 10;
 
@@ -528,7 +528,7 @@
 static int DrawShipPurchaseInfo(int x, int y, EngineID engine_number, const ShipVehicleInfo *svi)
 {
 	/* Purchase cost - Max speed */
-	SetDParamMoney(0, GetEngineProperty(engine_number, 0x0A, svi->base_cost) * (_price.ship_base >> 3) >> 5);
+	SetDParam(0, GetEngineProperty(engine_number, 0x0A, svi->base_cost) * (_price.ship_base >> 3) >> 5);
 	SetDParam(1, GetEngineProperty(engine_number, 0x0B, svi->max_speed) * 10 / 32);
 	DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
 	y += 10;
@@ -541,7 +541,7 @@
 	y += 10;
 
 	/* Running cost */
-	SetDParamMoney(0, GetEngineProperty(engine_number, 0x0F, svi->running_cost) * _price.ship_running >> 8);
+	SetDParam(0, GetEngineProperty(engine_number, 0x0F, svi->running_cost) * _price.ship_running >> 8);
 	DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 	y += 10;
 
@@ -554,7 +554,7 @@
 	CargoID cargo;
 
 	/* Purchase cost - Max speed */
-	SetDParamMoney(0, GetEngineProperty(engine_number, 0x0B, avi->base_cost) * (_price.aircraft_base >> 3) >> 5);
+	SetDParam(0, GetEngineProperty(engine_number, 0x0B, avi->base_cost) * (_price.aircraft_base >> 3) >> 5);
 	SetDParam(1, avi->max_speed * 10 / 16);
 	DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
 	y += 10;
@@ -576,7 +576,7 @@
 	y += 10;
 
 	/* Running cost */
-	SetDParamMoney(0, GetEngineProperty(engine_number, 0x0E, avi->running_cost) * _price.aircraft_running >> 8);
+	SetDParam(0, GetEngineProperty(engine_number, 0x0E, avi->running_cost) * _price.aircraft_running >> 8);
 	DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 	y += 10;
 
--- a/src/command.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/command.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -569,7 +569,7 @@
 	if (IsLocalPlayer() && _game_mode != GM_EDITOR) {
 		if (res2.GetCost() != 0) ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2.GetCost());
 		if (_additional_cash_required != 0) {
-			SetDParamMoney(0, _additional_cash_required);
+			SetDParam(0, _additional_cash_required);
 			ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x, y);
 			if (res2.GetCost() == 0) goto callb_err;
 		}
--- a/src/economy.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/economy.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -1783,7 +1783,7 @@
 
 	SetDParam(0, p->name_1);
 	SetDParam(1, p->name_2);
-	SetDParamMoney(2, p->bankrupt_value);
+	SetDParam(2, p->bankrupt_value);
 	AddNewsItem( (StringID)(_current_player | NB_BMERGER), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
 
 	/* original code does this a little bit differently */
--- a/src/engine_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/engine_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -120,12 +120,12 @@
 	const RailVehicleInfo *rvi = RailVehInfo(engine);
 	uint multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD) ? 1 : 0;
 
-	SetDParamMoney(0, (_price.build_railvehicle >> 3) * rvi->base_cost >> 5);
+	SetDParam(0, (_price.build_railvehicle >> 3) * rvi->base_cost >> 5);
 	SetDParam(2, rvi->max_speed * 10 / 16);
 	SetDParam(3, rvi->power << multihead);
 	SetDParam(1, rvi->weight << multihead);
 
-	SetDParamMoney(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8 << multihead);
+	SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8 << multihead);
 
 	if (rvi->capacity != 0) {
 		SetDParam(5, rvi->cargo_type);
@@ -139,11 +139,11 @@
 static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw)
 {
 	const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
-	SetDParamMoney(0, (_price.aircraft_base >> 3) * avi->base_cost >> 5);
+	SetDParam(0, (_price.aircraft_base >> 3) * avi->base_cost >> 5);
 	SetDParam(1, avi->max_speed * 10 / 16);
 	SetDParam(2, avi->passenger_capacity);
 	SetDParam(3, avi->mail_capacity);
-	SetDParamMoney(4, avi->running_cost * _price.aircraft_running >> 8);
+	SetDParam(4, avi->running_cost * _price.aircraft_running >> 8);
 
 	DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw);
 }
@@ -152,9 +152,9 @@
 {
 	const RoadVehicleInfo *rvi = RoadVehInfo(engine);
 
-	SetDParamMoney(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5);
+	SetDParam(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5);
 	SetDParam(1, rvi->max_speed * 10 / 32);
-	SetDParamMoney(2, rvi->running_cost * _price.roadveh_running >> 8);
+	SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8);
 	SetDParam(3, rvi->cargo_type);
 	SetDParam(4, rvi->capacity);
 
@@ -164,11 +164,11 @@
 static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw)
 {
 	const ShipVehicleInfo *svi = ShipVehInfo(engine);
-	SetDParamMoney(0, svi->base_cost * (_price.ship_base >> 3) >> 5);
+	SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5);
 	SetDParam(1, svi->max_speed * 10 / 32);
 	SetDParam(2, svi->cargo_type);
 	SetDParam(3, svi->capacity);
-	SetDParamMoney(4, svi->running_cost * _price.ship_running >> 8);
+	SetDParam(4, svi->running_cost * _price.ship_running >> 8);
 	DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw);
 }
 
--- a/src/graph_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/graph_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -162,7 +162,7 @@
 
 	for (int i = 0; i < GRAPH_NUM_LINES_Y; i++) {
 		SetDParam(0, gw->format_str_y_axis);
-		SetDParam64(1, y_label);
+		SetDParam(1, y_label);
 		DrawStringRightAligned(x, y, STR_0170, GRAPH_AXIS_LABEL_COLOUR);
 
 		y_label -= y_label_separation;
--- a/src/group_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/group_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -461,8 +461,8 @@
 							STR_PROFIT_GOOD_THIS_YEAR_GOOD_LAST_YEAR;
 				}
 
-				SetDParamMoney(0, v->profit_this_year);
-				SetDParamMoney(1, v->profit_last_year);
+				SetDParam(0, v->profit_this_year);
+				SetDParam(1, v->profit_last_year);
 				DrawString(x + 19, y2 + w->resize.step_height - 8, str, 0);
 
 				if (IsValidGroupID(v->group_id)) {
--- a/src/industry_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/industry_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -39,7 +39,7 @@
 		if (_thd.place_mode == 1 && _thd.window_class == WC_BUILD_INDUSTRY) {
 			int ind_type = _build_industry_types[_opt_ptr->landscape][WP(w, def_d).data_1];
 
-			SetDParamMoney(0, (_price.build_industry >> 8) * GetIndustrySpec(ind_type)->cost_multiplier);
+			SetDParam(0, (_price.build_industry >> 8) * GetIndustrySpec(ind_type)->cost_multiplier);
 			DrawStringCentered(85, w->height - 21, STR_482F_COST, 0);
 		}
 		break;
--- a/src/main_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/main_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -2208,7 +2208,7 @@
 
 		if (p != NULL) {
 			/* Draw player money */
-			SetDParamMoney(0, p->player_money);
+			SetDParam(0, p->player_money);
 			DrawStringCentered(570, 1, p->player_money >= 0 ? STR_0004 : STR_0005, 0);
 		}
 
--- a/src/misc_cmd.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/misc_cmd.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -129,7 +129,7 @@
 	Player *p = GetPlayer(_current_player);
 
 	if (p->current_loan >= _economy.max_loan) {
-		SetDParamMoney(0, _economy.max_loan);
+		SetDParam(0, _economy.max_loan);
 		return_cmd_error(STR_702B_MAXIMUM_PERMITTED_LOAN);
 	}
 
@@ -182,7 +182,7 @@
 	}
 
 	if (p->player_money < loan) {
-		SetDParamMoney(0, loan);
+		SetDParam(0, loan);
 		return_cmd_error(STR_702E_REQUIRED);
 	}
 
--- a/src/misc_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/misc_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -122,7 +122,7 @@
 
 	str = STR_01A4_COST_TO_CLEAR_N_A;
 	if (CmdSucceeded(costclear)) {
-		SetDParamMoney(0, costclear.GetCost());
+		SetDParam(0, costclear.GetCost());
 		str = STR_01A5_COST_TO_CLEAR;
 	}
 	GetString(_landinfo_data[2], str, lastof(_landinfo_data[2]));
@@ -478,7 +478,7 @@
 	AllocateWindowDescFront(&_build_trees_scen_desc, 0);
 }
 
-static uint32 _errmsg_decode_params[20];
+static uint64 _errmsg_decode_params[20];
 static StringID _errmsg_message_1, _errmsg_message_2;
 static uint _errmsg_duration;
 
@@ -618,7 +618,7 @@
 		cost = -cost;
 		msg = STR_0807_ESTIMATED_INCOME;
 	}
-	SetDParamMoney(0, cost);
+	SetDParam(0, cost);
 	ShowErrorMessage(INVALID_STRING_ID, msg, x, y);
 }
 
@@ -632,7 +632,7 @@
 		cost = -cost;
 		msg = STR_0803_INCOME;
 	}
-	SetDParamMoney(0, cost);
+	SetDParam(0, cost);
 	AddTextEffect(msg, pt.x, pt.y, 0x250, TE_RISING);
 }
 
@@ -640,7 +640,7 @@
 {
 	Point pt = RemapCoords(x,y,z);
 
-	SetDParamMoney(0, cost);
+	SetDParam(0, cost);
 	AddTextEffect(STR_FEEDER, pt.x, pt.y, 0x250, TE_RISING);
 }
 
@@ -1845,7 +1845,7 @@
 				if (ce->flags & CE_CLICK) {
 					DrawFrameRect(x + 20, y + 1, x + 30 + 9, y + 9, 0, (clk - (i * 2) == 1) ? FR_LOWERED : FR_NONE);
 					if (i == 0) { // XXX - hack/hack for first element which is increase money. Told ya it's a mess
-						SetDParam64(0, 10000000);
+						SetDParam(0, 10000000);
 					} else {
 						SetDParam(0, false);
 					}
--- a/src/network/network_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/network/network_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -894,15 +894,15 @@
 			DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, 2); // inauguration year
 			y += 10;
 
-			SetDParamMoney(0, _network_player_info[nd->company].company_value);
+			SetDParam(0, _network_player_info[nd->company].company_value);
 			DrawString(x, y, STR_NETWORK_VALUE, 2); // company value
 			y += 10;
 
-			SetDParamMoney(0, _network_player_info[nd->company].money);
+			SetDParam(0, _network_player_info[nd->company].money);
 			DrawString(x, y, STR_NETWORK_CURRENT_BALANCE, 2); // current balance
 			y += 10;
 
-			SetDParamMoney(0, _network_player_info[nd->company].income);
+			SetDParam(0, _network_player_info[nd->company].income);
 			DrawString(x, y, STR_NETWORK_LAST_YEARS_INCOME, 2); // last year's income
 			y += 10;
 
--- a/src/openttd.h	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/openttd.h	Thu Jun 21 17:25:17 2007 +0000
@@ -353,7 +353,7 @@
 	StringID str;
 	Owner owner;
 	Date build_date;
-	uint32 dparam[2];
+	uint64 dparam[2];
 };
 
 struct ViewportSign {
--- a/src/player_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/player_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -60,14 +60,14 @@
 
 						str = STR_701E;
 						if (cost < 0) { cost = -cost; str++; }
-						SetDParamMoney(0, cost);
+						SetDParam(0, cost);
 						DrawStringRightAligned(x, 27 + i * 10, str, 0);
 					}
 				}
 
 				str = STR_701E;
 				if (sum < 0) { sum = -sum; str++; }
-				SetDParamMoney(0, sum);
+				SetDParam(0, sum);
 				DrawStringRightAligned(x, 27 + 13 * 10 + 2, str, 0);
 
 				GfxFillRect(x - 75, 27 + 10 * 13, x, 27 + 10 * 13, 215);
@@ -80,27 +80,27 @@
 		y = 171;
 
 		/* draw max loan aligned to loan below (y += 10) */
-		SetDParamMoney(0, _economy.max_loan);
+		SetDParam(0, _economy.max_loan);
 		DrawString(202, y + 10, STR_MAX_LOAN, 0);
 	} else {
 		y = 15;
 	}
 
 	DrawString(2, y, STR_7026_BANK_BALANCE, 0);
-	SetDParamMoney(0, p->player_money);
+	SetDParam(0, p->player_money);
 	DrawStringRightAligned(182, y, STR_7028, 0);
 
 	y += 10;
 
 	DrawString(2, y, STR_7027_LOAN, 0);
-	SetDParamMoney(0, p->current_loan);
+	SetDParam(0, p->current_loan);
 	DrawStringRightAligned(182, y, STR_7028, 0);
 
 	y += 12;
 
 	GfxFillRect(182 - 75, y - 2, 182, y - 2, 215);
 
-	SetDParamMoney(0, p->player_money - p->current_loan);
+	SetDParam(0, p->player_money - p->current_loan);
 	DrawStringRightAligned(182, y, STR_7028, 0);
 }
 
@@ -778,7 +778,7 @@
 			SetDParam(1, p->president_name_2);
 			DrawStringMultiCenter(48, 141, STR_7037_PRESIDENT, 94);
 
-			SetDParamMoney(0, CalculateCompanyValue(p));
+			SetDParam(0, CalculateCompanyValue(p));
 			DrawString(110, 114, STR_7076_COMPANY_VALUE, 0);
 
 			DrawCompanyOwnerText(p);
@@ -947,7 +947,7 @@
 
 		SetDParam(0, p->name_1);
 		SetDParam(1, p->name_2);
-		SetDParamMoney(2, p->bankrupt_value);
+		SetDParam(2, p->bankrupt_value);
 		DrawStringMultiCenter(214, 65, STR_705B_WE_ARE_LOOKING_FOR_A_TRANSPORT, 238);
 		break;
 	}
--- a/src/players.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/players.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -178,7 +178,7 @@
 	if (cost.GetCost() > 0) {
 		PlayerID pid = _current_player;
 		if (IsValidPlayer(pid) && cost.GetCost() > GetPlayer(pid)->player_money) {
-			SetDParamMoney(0, cost.GetCost());
+			SetDParam(0, cost.GetCost());
 			_error_message = STR_0003_NOT_ENOUGH_CASH_REQUIRES;
 			return false;
 		}
--- a/src/roadveh_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/roadveh_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -92,7 +92,7 @@
 
 			SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED);
 			SetDParam(2, v->max_age / 366);
-			SetDParamMoney(3, RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running >> 8);
+			SetDParam(3, RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running >> 8);
 			DrawString(2, 15, STR_900D_AGE_RUNNING_COST_YR, 0);
 		}
 
@@ -104,8 +104,8 @@
 
 		/* Draw profit */
 		{
-			SetDParamMoney(0, v->profit_this_year);
-			SetDParamMoney(1, v->profit_last_year);
+			SetDParam(0, v->profit_this_year);
+			SetDParam(1, v->profit_last_year);
 			DrawString(2, 35, STR_900F_PROFIT_THIS_YEAR_LAST_YEAR, 0);
 		}
 
@@ -120,7 +120,7 @@
 
 		SetDParam(0, GetCustomEngineName(v->engine_type));
 		SetDParam(1, v->build_year);
-		SetDParamMoney(2, v->value);
+		SetDParam(2, v->value);
 		DrawString(34, 57 + y_offset, STR_9011_BUILT_VALUE, 0);
 
 		if (RoadVehHasArticPart(v)) {
@@ -182,7 +182,7 @@
 		}
 
 		/* Draw Transfer credits text */
-		SetDParamMoney(0, v->cargo_feeder_share);
+		SetDParam(0, v->cargo_feeder_share);
 		DrawString(34, 90 + y_offset, STR_FEEDER_CARGO_VALUE, 0);
 
 		/* Draw service interval text */
--- a/src/ship_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/ship_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -50,7 +50,7 @@
 
 			SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED);
 			SetDParam(2, v->max_age / 366);
-			SetDParamMoney(3, ShipVehInfo(v->engine_type)->running_cost * _price.ship_running >> 8);
+			SetDParam(3, ShipVehInfo(v->engine_type)->running_cost * _price.ship_running >> 8);
 			DrawString(2, 15, STR_9812_AGE_RUNNING_COST_YR, 0);
 		}
 
@@ -62,8 +62,8 @@
 
 		/* Draw profit */
 		{
-			SetDParamMoney(0, v->profit_this_year);
-			SetDParamMoney(1, v->profit_last_year);
+			SetDParam(0, v->profit_this_year);
+			SetDParam(1, v->profit_last_year);
 			DrawString(2, 35, STR_9814_PROFIT_THIS_YEAR_LAST_YEAR, 0);
 		}
 
@@ -85,7 +85,7 @@
 
 		SetDParam(1, v->build_year);
 		SetDParam(0, GetCustomEngineName(v->engine_type));
-		SetDParamMoney(2, v->value);
+		SetDParam(2, v->value);
 		DrawString(74, 57, STR_9816_BUILT_VALUE, 0);
 
 		SetDParam(0, v->cargo_type);
@@ -102,7 +102,7 @@
 		DrawString(74, 78, str, 0);
 
 		/* Draw Transfer credits text */
-		SetDParamMoney(0, v->cargo_feeder_share);
+		SetDParam(0, v->cargo_feeder_share);
 		DrawString(74, 89, STR_FEEDER_CARGO_VALUE, 0);
 
 	} break;
--- a/src/strings.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/strings.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -38,9 +38,9 @@
 
 static char *StationGetSpecialString(char *buff, int x, const char* last);
 static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed, const char* last);
-static char *GetSpecialPlayerNameString(char *buff, int ind, const int32 *argv, const char* last);
+static char *GetSpecialPlayerNameString(char *buff, int ind, const int64 *argv, const char* last);
 
-static char *FormatString(char *buff, const char *str, const int32 *argv, uint casei, const char* last);
+static char *FormatString(char *buff, const char *str, const int64 *argv, uint casei, const char* last);
 
 struct LanguagePack {
 	uint32 ident;       // 32-bits identifier
@@ -61,27 +61,22 @@
 
 
 /** Read an int64 from the argv array. */
-static inline int64 GetInt64(const int32 **argv)
-{
-	int64 result;
-
-	assert(argv);
-	result = (uint32)(*argv)[0] + ((uint64)(uint32)(*argv)[1] << 32);
-	(*argv) += 2;
-	return result;
-}
-
-/** Read an int32 from the argv array. */
-static inline int32 GetInt32(const int32 **argv)
+static inline int64 GetInt64(const int64 **argv)
 {
 	assert(argv);
 	return *(*argv)++;
 }
 
+/** Read an int32 from the argv array. */
+static inline int32 GetInt32(const int64 **argv)
+{
+	return (int32)GetInt64(argv);
+}
+
 /** Read an array from the argv array. */
-static inline const int32 *GetArgvPtr(const int32 **argv, int n)
+static inline const int64 *GetArgvPtr(const int64 **argv, int n)
 {
-	const int32 *result;
+	const int64 *result;
 	assert(*argv);
 	result = *argv;
 	(*argv) += n;
@@ -115,7 +110,7 @@
  * @param last
  * @return a formatted string of char
  */
-static char *GetStringWithArgs(char *buffr, uint string, const int32 *argv, const char* last)
+static char *GetStringWithArgs(char *buffr, uint string, const int64 *argv, const char* last)
 {
 	uint index = GB(string,  0, 11);
 	uint tab   = GB(string, 11,  5);
@@ -180,7 +175,7 @@
 
 char *GetString(char *buffr, StringID string, const char* last)
 {
-	return GetStringWithArgs(buffr, string, (int32*)_decode_parameters, last);
+	return GetStringWithArgs(buffr, string, (int64*)_decode_parameters, last);
 }
 
 
@@ -312,7 +307,7 @@
 	YearMonthDay ymd;
 	ConvertDateToYMD(date, &ymd);
 
-	int32 args[3] = { ymd.day + STR_01AC_1ST - 1, STR_0162_JAN + ymd.month, ymd.year };
+	int64 args[3] = { ymd.day + STR_01AC_1ST - 1, STR_0162_JAN + ymd.month, ymd.year };
 	return FormatString(buff, GetStringPtr(STR_DATE_LONG), args, 0, last);
 }
 
@@ -321,7 +316,7 @@
 	YearMonthDay ymd;
 	ConvertDateToYMD(date, &ymd);
 
-	int32 args[2] = { STR_MONTH_JAN + ymd.month, ymd.year };
+	int64 args[2] = { STR_MONTH_JAN + ymd.month, ymd.year };
 	return FormatString(buff, GetStringPtr(STR_DATE_SHORT), args, 0, last);
 }
 
@@ -336,7 +331,7 @@
 	snprintf(day,   lengthof(day),   "%02i", ymd.day);
 	snprintf(month, lengthof(month), "%02i", ymd.month + 1);
 
-	int32 args[3] = { BindCString(day), BindCString(month), ymd.year };
+	int64 args[3] = { BindCString(day), BindCString(month), ymd.year };
 	return FormatString(buff, GetStringPtr(STR_DATE_TINY), args, 0, last);
 }
 
@@ -525,11 +520,11 @@
 	},
 };
 
-static char* FormatString(char* buff, const char* str, const int32* argv, uint casei, const char* last)
+static char* FormatString(char* buff, const char* str, const int64* argv, uint casei, const char* last)
 {
 	extern const char _openttd_revision[];
 	WChar b;
-	const int32 *argv_orig = argv;
+	const int64 *argv_orig = argv;
 	uint modifier = 0;
 
 	while ((b = Utf8Consume(&str)) != '\0') {
@@ -562,7 +557,7 @@
 				break;
 
 			case SCC_VELOCITY: {// {VELOCITY}
-				int32 args[1];
+				int64 args[1];
 				assert(_opt_ptr->units < lengthof(units));
 				args[0] = GetInt32(&argv) * units[_opt_ptr->units].s_m >> units[_opt_ptr->units].s_s;
 				buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].velocity), args, modifier >> 24, last);
@@ -585,7 +580,7 @@
 				StringID cargo_str = GetCargo(GetInt32(&argv))->units_volume;
 				switch (cargo_str) {
 					case STR_TONS: {
-						int32 args[1];
+						int64 args[1];
 						assert(_opt_ptr->units < lengthof(units));
 						args[0] = GetInt32(&argv) * units[_opt_ptr->units].w_m >> units[_opt_ptr->units].w_s;
 						buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].l_weight), args, modifier >> 24, last);
@@ -594,7 +589,7 @@
 					}
 
 					case STR_LITERS: {
-						int32 args[1];
+						int64 args[1];
 						assert(_opt_ptr->units < lengthof(units));
 						args[0] = GetInt32(&argv) * units[_opt_ptr->units].v_m >> units[_opt_ptr->units].v_s;
 						buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].l_volume), args, modifier >> 24, last);
@@ -669,7 +664,7 @@
 
 			case SCC_INDUSTRY_NAME: { /* {INDUSTRY} */
 				const Industry* i = GetIndustry(GetInt32(&argv));
-				int32 args[2];
+				int64 args[2];
 
 				/* industry not valid anymore? */
 				if (!IsValidIndustry(i)) break;
@@ -684,7 +679,7 @@
 			}
 
 			case SCC_VOLUME: { // {VOLUME}
-				int32 args[1];
+				int64 args[1];
 				assert(_opt_ptr->units < lengthof(units));
 				args[0] = GetInt32(&argv) * units[_opt_ptr->units].v_m >> units[_opt_ptr->units].v_s;
 				buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].l_volume), args, modifier >> 24, last);
@@ -718,7 +713,7 @@
 			}
 
 			case SCC_POWER: { // {POWER}
-				int32 args[1];
+				int64 args[1];
 				assert(_opt_ptr->units < lengthof(units));
 				args[0] = GetInt32(&argv) * units[_opt_ptr->units].p_m >> units[_opt_ptr->units].p_s;
 				buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].power), args, modifier >> 24, last);
@@ -727,7 +722,7 @@
 			}
 
 			case SCC_VOLUME_SHORT: { // {VOLUME_S}
-				int32 args[1];
+				int64 args[1];
 				assert(_opt_ptr->units < lengthof(units));
 				args[0] = GetInt32(&argv) * units[_opt_ptr->units].v_m >> units[_opt_ptr->units].v_s;
 				buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].s_volume), args, modifier >> 24, last);
@@ -736,7 +731,7 @@
 			}
 
 			case SCC_WEIGHT: { // {WEIGHT}
-				int32 args[1];
+				int64 args[1];
 				assert(_opt_ptr->units < lengthof(units));
 				args[0] = GetInt32(&argv) * units[_opt_ptr->units].w_m >> units[_opt_ptr->units].w_s;
 				buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].l_weight), args, modifier >> 24, last);
@@ -745,7 +740,7 @@
 			}
 
 			case SCC_WEIGHT_SHORT: { // {WEIGHT_S}
-				int32 args[1];
+				int64 args[1];
 				assert(_opt_ptr->units < lengthof(units));
 				args[0] = GetInt32(&argv) * units[_opt_ptr->units].w_m >> units[_opt_ptr->units].w_s;
 				buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].s_weight), args, modifier >> 24, last);
@@ -754,7 +749,7 @@
 			}
 
 			case SCC_FORCE: { // {FORCE}
-				int32 args[1];
+				int64 args[1];
 				assert(_opt_ptr->units < lengthof(units));
 				args[0] = GetInt32(&argv) * units[_opt_ptr->units].f_m >> units[_opt_ptr->units].f_s;
 				buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].force), args, modifier >> 24, last);
@@ -807,7 +802,7 @@
 				break;
 
 			case SCC_WAYPOINT_NAME: { // {WAYPOINT}
-				int32 temp[2];
+				int64 temp[2];
 				Waypoint *wp = GetWaypoint(GetInt32(&argv));
 				StringID str;
 				if (wp->string != STR_NULL) {
@@ -827,7 +822,7 @@
 				if (!st->IsValid()) { // station doesn't exist anymore
 					buff = GetStringWithArgs(buff, STR_UNKNOWN_DESTINATION, NULL, last);
 				} else {
-					int32 temp[2];
+					int64 temp[2];
 					temp[0] = STR_TOWN;
 					temp[1] = st->town->index;
 					buff = GetStringWithArgs(buff, st->string_id, temp, last);
@@ -837,7 +832,7 @@
 
 			case SCC_TOWN_NAME: { // {TOWN}
 				const Town* t = GetTown(GetInt32(&argv));
-				int32 temp[1];
+				int64 temp[1];
 
 				assert(IsValidTown(t));
 
@@ -862,7 +857,7 @@
 
 			case SCC_GROUP_NAME: { // {GROUP}
 				const Group *g = GetGroup(GetInt32(&argv));
-				int32 args[1];
+				int64 args[1];
 
 				assert(IsValidGroup(g));
 
@@ -1046,7 +1041,7 @@
 	return buff;
 }
 
-static char *GetSpecialPlayerNameString(char *buff, int ind, const int32 *argv, const char* last)
+static char *GetSpecialPlayerNameString(char *buff, int ind, const int64 *argv, const char* last)
 {
 	switch (ind) {
 		case 1: // not used
--- a/src/town_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/town_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -175,7 +175,7 @@
 			int i = WP(w,def_d).data_1;
 
 			if (i != -1) {
-				SetDParamMoney(1, (_price.build_industry >> 8) * _town_action_costs[i]);
+				SetDParam(1, (_price.build_industry >> 8) * _town_action_costs[i]);
 				SetDParam(0, STR_2046_SMALL_ADVERTISING_CAMPAIGN + i);
 				DrawStringMultiLine(2, 159, STR_204D_INITIATE_A_SMALL_LOCAL + i, 313);
 			}
--- a/src/train_cmd.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/train_cmd.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -3422,7 +3422,7 @@
 		if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
 			/* show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list) */
 			if (_patches.train_income_warn && v->owner == _local_player && v->age >= 730 && v->profit_this_year < 0) {
-				SetDParamMoney(1, v->profit_this_year);
+				SetDParam(1, v->profit_this_year);
 				SetDParam(0, v->unitnumber);
 				AddNewsItem(
 					STR_TRAIN_IS_UNPROFITABLE,
--- a/src/train_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/train_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -345,12 +345,12 @@
 {
 	if (RailVehInfo(v->engine_type)->railveh_type == RAILVEH_WAGON) {
 		SetDParam(0, GetCustomEngineName(v->engine_type));
-		SetDParamMoney(1, v->value);
+		SetDParam(1, v->value);
 		DrawString(x, y, STR_882D_VALUE, 0x10);
 	} else {
 		SetDParam(0, GetCustomEngineName(v->engine_type));
 		SetDParam(1, v->build_year);
-		SetDParamMoney(2, v->value);
+		SetDParam(2, v->value);
 		DrawString(x, y, STR_882C_BUILT_VALUE, 0x10);
 	}
 }
@@ -423,7 +423,7 @@
 
 	SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED);
 	SetDParam(2, v->max_age / 366);
-	SetDParamMoney(3, GetTrainRunningCost(v) >> 8);
+	SetDParam(3, GetTrainRunningCost(v) >> 8);
 	DrawString(x, 15, STR_885D_AGE_RUNNING_COST_YR, 0);
 
 	SetDParam(2, v->u.rail.cached_max_speed * 10 / 16);
@@ -434,8 +434,8 @@
 		STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :
 		STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, 0);
 
-	SetDParamMoney(0, v->profit_this_year);
-	SetDParamMoney(1, v->profit_last_year);
+	SetDParam(0, v->profit_this_year);
+	SetDParam(1, v->profit_last_year);
 	DrawString(x, 35, STR_885F_PROFIT_THIS_YEAR_LAST_YEAR, 0);
 
 	SetDParam(0, 100 * (v->reliability>>8) >> 8);
@@ -504,7 +504,7 @@
 				DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_013F_TOTAL_CAPACITY, 0);
 			}
 		}
-		SetDParamMoney(0, v->cargo_feeder_share);
+		SetDParam(0, v->cargo_feeder_share);
 		DrawString(x, y + 15, STR_FEEDER_CARGO_VALUE, 0);
 	}
 }
--- a/src/tunnel_map.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/tunnel_map.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -39,7 +39,7 @@
  * @param dir  the direction to start searching to.
  * @return true if and only if there is a tunnel.
  */
-static bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir)
+bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir)
 {
 	TileIndexDiff delta = TileOffsByDiagDir(dir);
 	uint height;
--- a/src/tunnel_map.h	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/tunnel_map.h	Thu Jun 21 17:25:17 2007 +0000
@@ -87,6 +87,7 @@
 
 TileIndex GetOtherTunnelEnd(TileIndex);
 bool IsTunnelInWay(TileIndex, uint z);
+bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir);
 
 
 /**
--- a/src/tunnelbridge_cmd.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/tunnelbridge_cmd.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -491,6 +491,13 @@
 	 * position, because of increased-cost-by-length: 'cost += cost >> 3' */
 
 	delta = TileOffsByDiagDir(direction);
+	DiagDirection tunnel_in_way_dir;
+	if (OtherAxis(DiagDirToAxis(direction)) == AXIS_X) {
+		tunnel_in_way_dir = (TileX(start_tile) < (MapMaxX() / 2)) ? DIAGDIR_SW : DIAGDIR_NE;
+	} else {
+		tunnel_in_way_dir = (TileY(start_tile) < (MapMaxX() / 2)) ? DIAGDIR_SE : DIAGDIR_NW;
+	}
+
 	end_tile = start_tile;
 	for (;;) {
 		end_tile += delta;
@@ -498,13 +505,14 @@
 
 		if (start_z == end_z) break;
 
-		if (!_cheats.crossing_tunnels.value && IsTunnelInWay(end_tile, start_z)) {
+		if (!_cheats.crossing_tunnels.value && IsTunnelInWayDir(end_tile, start_z, tunnel_in_way_dir)) {
 			return_cmd_error(STR_5003_ANOTHER_TUNNEL_IN_THE_WAY);
 		}
 
 		cost.AddCost(_price.build_tunnel);
 		cost.AddCost(cost.GetCost() >> 3); // add a multiplier for longer tunnels
 	}
+	cost.MultiplyCost(0);
 
 	/* Add the cost of the entrance */
 	cost.AddCost(_price.build_tunnel);
--- a/src/variables.h	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/variables.h	Thu Jun 21 17:25:17 2007 +0000
@@ -289,7 +289,7 @@
 VARDEF StringID _error_message;
 VARDEF Money _additional_cash_required;
 
-VARDEF uint32 _decode_parameters[20];
+VARDEF uint64 _decode_parameters[20];
 
 VARDEF bool _rightclick_emulate;
 
@@ -345,32 +345,23 @@
 VARDEF char *_log_file;
 
 
-static inline void SetDParamX(uint32 *s, uint n, uint32 v)
+static inline void SetDParamX(uint64 *s, uint n, uint64 v)
 {
 	s[n] = v;
 }
 
-static inline uint32 GetDParamX(const uint32 *s, uint n)
+static inline uint64 GetDParamX(const uint64 *s, uint n)
 {
 	return s[n];
 }
 
-static inline void SetDParam(uint n, uint32 v)
+static inline void SetDParam(uint n, uint64 v)
 {
 	assert(n < lengthof(_decode_parameters));
 	_decode_parameters[n] = v;
 }
 
-static inline void SetDParam64(uint n, uint64 v)
-{
-	assert(n + 1 < lengthof(_decode_parameters));
-	_decode_parameters[n + 0] = v & 0xffffffff;
-	_decode_parameters[n + 1] = v >> 32;
-}
-
-static inline void SetDParamMoney(uint n, Money m) { SetDParam64(n, (uint64)m); }
-
-static inline uint32 GetDParam(uint n)
+static inline uint64 GetDParam(uint n)
 {
 	assert(n < lengthof(_decode_parameters));
 	return _decode_parameters[n];
@@ -387,8 +378,8 @@
 StringID BindCString(const char *str);
 
 
-#define COPY_IN_DPARAM(offs, src, num) memcpy(_decode_parameters + offs, src, sizeof(uint32) * (num))
-#define COPY_OUT_DPARAM(dst, offs, num) memcpy(dst, _decode_parameters + offs, sizeof(uint32) * (num))
+#define COPY_IN_DPARAM(offs, src, num) memcpy(_decode_parameters + offs, src, sizeof(uint64) * (num))
+#define COPY_OUT_DPARAM(dst, offs, num) memcpy(dst, _decode_parameters + offs, sizeof(uint64) * (num))
 
 
 #define SET_EXPENSES_TYPE(x) _yearly_expenses_type = x;
--- a/src/vehicle_gui.cpp	Thu Jun 21 17:18:33 2007 +0000
+++ b/src/vehicle_gui.cpp	Thu Jun 21 17:25:17 2007 +0000
@@ -346,7 +346,7 @@
 				if (CmdSucceeded(cost)) {
 					SetDParam(0, WP(w, refit_d).cargo->cargo);
 					SetDParam(1, _returned_refit_capacity);
-					SetDParamMoney(2, cost.GetCost());
+					SetDParam(2, cost.GetCost());
 					DrawString(2, w->widget[5].top + 1, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0);
 				}
 			}
@@ -1005,8 +1005,8 @@
 		const Vehicle *v = vl->sort_list[i];
 		StringID str;
 
-		SetDParamMoney(0, v->profit_this_year);
-		SetDParamMoney(1, v->profit_last_year);
+		SetDParam(0, v->profit_this_year);
+		SetDParam(1, v->profit_last_year);
 
 		DrawVehicleImage(v, x + 19, y + 6, w->widget[VLW_WIDGET_LIST].right - w->widget[VLW_WIDGET_LIST].left - 20, 0, INVALID_VEHICLE);
 		DrawString(x + 19, y + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);