(svn r10247) -Fix (r10210): *always* call SetDParamMoney when you want to place money in some string.
authorrubidium
Thu, 21 Jun 2007 14:54:51 +0000
changeset 7487 9ef3bd32c2eb
parent 7486 d130c10f4dab
child 7488 eb26c679b484
(svn r10247) -Fix (r10210): *always* call SetDParamMoney when you want to place money in some string.
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/player_gui.cpp
src/players.cpp
src/roadveh_gui.cpp
src/ship_gui.cpp
src/town_gui.cpp
src/train_cmd.cpp
src/train_gui.cpp
src/variables.h
src/vehicle_gui.cpp
--- a/src/aircraft_gui.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/aircraft_gui.cpp	Thu Jun 21 14:54:51 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);
-			SetDParam(3, _price.aircraft_running * AircraftVehInfo(v->engine_type)->running_cost >> 8);
+			SetDParamMoney(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 */
 		{
-			SetDParam(0, v->profit_this_year);
-			SetDParam(1, v->profit_last_year);
+			SetDParamMoney(0, v->profit_this_year);
+			SetDParamMoney(1, v->profit_last_year);
 			DrawString(2, 35, STR_A00F_PROFIT_THIS_YEAR_LAST_YEAR, 0);
 		}
 
@@ -125,7 +125,7 @@
 
 		/* Draw Transfer credits text */
 		{
-			SetDParam(0, v->cargo_feeder_share);
+			SetDParamMoney(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);
-					SetDParam(2, v->value);
+					SetDParamMoney(2, v->value);
 					DrawString(60, y, STR_A011_BUILT_VALUE, 0);
 					y += 10;
 
--- a/src/bridge_gui.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/bridge_gui.cpp	Thu Jun 21 14:54:51 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]];
 
-				SetDParam(2, _bridgedata.costs[i + w->vscroll.pos]);
+				SetDParamMoney(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 14:32:27 2007 +0000
+++ b/src/build_vehicle_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -434,7 +434,7 @@
 static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const RailVehicleInfo *rvi)
 {
 	/* Purchase cost */
-	SetDParam(0, (GetEngineProperty(engine_number, 0x17, rvi->base_cost) * _price.build_railwagon) >> 8);
+	SetDParamMoney(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 */
-	SetDParam(0, GetEngineProperty(engine_number, 0x17, rvi->base_cost) * (_price.build_railvehicle >> 3) >> 5);
+	SetDParamMoney(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 */
-	SetDParam(0, (GetEngineProperty(engine_number, 0x0D, rvi->running_cost_base) * _price.running_rail[rvi->running_cost_class] >> 8) << multihead);
+	SetDParamMoney(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 */
-	SetDParam(0, GetEngineProperty(engine_number, 0x11, rvi->base_cost) * (_price.roadveh_base >> 3) >> 5);
+	SetDParamMoney(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 */
-	SetDParam(0, rvi->running_cost * _price.roadveh_running >> 8);
+	SetDParamMoney(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 */
-	SetDParam(0, GetEngineProperty(engine_number, 0x0A, svi->base_cost) * (_price.ship_base >> 3) >> 5);
+	SetDParamMoney(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 */
-	SetDParam(0, GetEngineProperty(engine_number, 0x0F, svi->running_cost) * _price.ship_running >> 8);
+	SetDParamMoney(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 */
-	SetDParam(0, GetEngineProperty(engine_number, 0x0B, avi->base_cost) * (_price.aircraft_base >> 3) >> 5);
+	SetDParamMoney(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 */
-	SetDParam(0, GetEngineProperty(engine_number, 0x0E, avi->running_cost) * _price.aircraft_running >> 8);
+	SetDParamMoney(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 14:32:27 2007 +0000
+++ b/src/command.cpp	Thu Jun 21 14:54:51 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) {
-			SetDParam(0, _additional_cash_required);
+			SetDParamMoney(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 14:32:27 2007 +0000
+++ b/src/economy.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -1773,7 +1773,7 @@
 
 	SetDParam(0, p->name_1);
 	SetDParam(1, p->name_2);
-	SetDParam(2, p->bankrupt_value);
+	SetDParamMoney(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 14:32:27 2007 +0000
+++ b/src/engine_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -120,12 +120,12 @@
 	const RailVehicleInfo *rvi = RailVehInfo(engine);
 	uint multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD) ? 1 : 0;
 
-	SetDParam(0, (_price.build_railvehicle >> 3) * rvi->base_cost >> 5);
+	SetDParamMoney(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);
 
-	SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8 << multihead);
+	SetDParamMoney(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);
-	SetDParam(0, (_price.aircraft_base >> 3) * avi->base_cost >> 5);
+	SetDParamMoney(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);
-	SetDParam(4, avi->running_cost * _price.aircraft_running >> 8);
+	SetDParamMoney(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);
 
-	SetDParam(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5);
+	SetDParamMoney(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5);
 	SetDParam(1, rvi->max_speed * 10 / 32);
-	SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8);
+	SetDParamMoney(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);
-	SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5);
+	SetDParamMoney(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);
-	SetDParam(4, svi->running_cost * _price.ship_running >> 8);
+	SetDParamMoney(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 14:32:27 2007 +0000
+++ b/src/graph_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -64,7 +64,7 @@
 	uint height;    ///< The height of the graph in pixels.
 	StringID format_str_y_axis;
 	byte colors[GRAPH_MAX_DATASETS];
-	int64 cost[GRAPH_MAX_DATASETS][24]; ///< last 2 years
+	Money cost[GRAPH_MAX_DATASETS][24]; ///< last 2 years
 };
 
 static void DrawGraph(const GraphDrawer *gw)
@@ -132,7 +132,7 @@
 	for (int i = 0; i < gw->num_dataset; i++) {
 		if (!HASBIT(gw->excluded_data, i)) {
 			for (int j = 0; j < gw->num_on_x_axis; j++) {
-				int64 datapoint = gw->cost[i][j];
+				Money datapoint = gw->cost[i][j];
 
 				if (datapoint != INVALID_DATAPOINT) {
 					/* For now, if the graph has negative values the scaling is
@@ -214,7 +214,7 @@
 			uint prev_y = INVALID_DATAPOINT_POS;
 
 			for (int j = 0; j < gw->num_on_x_axis; j++) {
-				int64 datapoint = gw->cost[i][j];
+				Money datapoint = gw->cost[i][j];
 
 				if (datapoint != INVALID_DATAPOINT) {
 					/* XXX: This can overflow if x_axis_offset * datapoint is
--- a/src/group_gui.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/group_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -461,8 +461,8 @@
 							STR_PROFIT_GOOD_THIS_YEAR_GOOD_LAST_YEAR;
 				}
 
-				SetDParam(0, v->profit_this_year);
-				SetDParam(1, v->profit_last_year);
+				SetDParamMoney(0, v->profit_this_year);
+				SetDParamMoney(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 14:32:27 2007 +0000
+++ b/src/industry_gui.cpp	Thu Jun 21 14:54:51 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];
 
-			SetDParam(0, (_price.build_industry >> 8) * GetIndustrySpec(ind_type)->cost_multiplier);
+			SetDParamMoney(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 14:32:27 2007 +0000
+++ b/src/main_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -2208,7 +2208,7 @@
 
 		if (p != NULL) {
 			/* Draw player money */
-			SetDParam64(0, p->player_money);
+			SetDParamMoney(0, p->player_money);
 			DrawStringCentered(570, 1, p->player_money >= 0 ? STR_0004 : STR_0005, 0);
 		}
 
--- a/src/misc_cmd.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/misc_cmd.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -129,7 +129,7 @@
 	Player *p = GetPlayer(_current_player);
 
 	if (p->current_loan >= _economy.max_loan) {
-		SetDParam(0, _economy.max_loan);
+		SetDParamMoney(0, _economy.max_loan);
 		return_cmd_error(STR_702B_MAXIMUM_PERMITTED_LOAN);
 	}
 
@@ -173,7 +173,7 @@
 	switch (p2) {
 		default: return CMD_ERROR; // Invalid method
 		case 0: // Pay back one step
-			loan = min(p->current_loan, (IsHumanPlayer(_current_player) || _patches.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI);
+			loan = min(p->current_loan, (Money)(IsHumanPlayer(_current_player) || _patches.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI);
 			break;
 		case 1: // Pay back as much as possible
 			loan = max(min(p->current_loan, p->player_money), (Money)LOAN_INTERVAL);
@@ -182,7 +182,7 @@
 	}
 
 	if (p->player_money < loan) {
-		SetDParam(0, loan);
+		SetDParamMoney(0, loan);
 		return_cmd_error(STR_702E_REQUIRED);
 	}
 
@@ -307,7 +307,7 @@
 CommandCost CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 {
 	const Player *p = GetPlayer(_current_player);
-	CommandCost amount(min((Money)p1, 20000000LL));
+	CommandCost amount(min((Money)p1, (Money)20000000LL));
 
 	SET_EXPENSES_TYPE(EXPENSES_OTHER);
 
--- a/src/misc_gui.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/misc_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -122,7 +122,7 @@
 
 	str = STR_01A4_COST_TO_CLEAR_N_A;
 	if (CmdSucceeded(costclear)) {
-		SetDParam(0, costclear.GetCost());
+		SetDParamMoney(0, costclear.GetCost());
 		str = STR_01A5_COST_TO_CLEAR;
 	}
 	GetString(_landinfo_data[2], str, lastof(_landinfo_data[2]));
@@ -618,7 +618,7 @@
 		cost = -cost;
 		msg = STR_0807_ESTIMATED_INCOME;
 	}
-	SetDParam(0, cost);
+	SetDParamMoney(0, cost);
 	ShowErrorMessage(INVALID_STRING_ID, msg, x, y);
 }
 
@@ -632,7 +632,7 @@
 		cost = -cost;
 		msg = STR_0803_INCOME;
 	}
-	SetDParam(0, cost);
+	SetDParamMoney(0, cost);
 	AddTextEffect(msg, pt.x, pt.y, 0x250);
 }
 
@@ -640,7 +640,7 @@
 {
 	Point pt = RemapCoords(x,y,z);
 
-	SetDParam(0, cost);
+	SetDParamMoney(0, cost);
 	AddTextEffect(STR_FEEDER, pt.x, pt.y, 0x250);
 }
 
--- a/src/network/network_gui.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/network/network_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -894,15 +894,15 @@
 			DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, 2); // inauguration year
 			y += 10;
 
-			SetDParam64(0, _network_player_info[nd->company].company_value);
+			SetDParamMoney(0, _network_player_info[nd->company].company_value);
 			DrawString(x, y, STR_NETWORK_VALUE, 2); // company value
 			y += 10;
 
-			SetDParam64(0, _network_player_info[nd->company].money);
+			SetDParamMoney(0, _network_player_info[nd->company].money);
 			DrawString(x, y, STR_NETWORK_CURRENT_BALANCE, 2); // current balance
 			y += 10;
 
-			SetDParam64(0, _network_player_info[nd->company].income);
+			SetDParamMoney(0, _network_player_info[nd->company].income);
 			DrawString(x, y, STR_NETWORK_LAST_YEARS_INCOME, 2); // last year's income
 			y += 10;
 
--- a/src/player_gui.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/player_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -60,14 +60,14 @@
 
 						str = STR_701E;
 						if (cost < 0) { cost = -cost; str++; }
-						SetDParam64(0, cost);
+						SetDParamMoney(0, cost);
 						DrawStringRightAligned(x, 27 + i * 10, str, 0);
 					}
 				}
 
 				str = STR_701E;
 				if (sum < 0) { sum = -sum; str++; }
-				SetDParam64(0, sum);
+				SetDParamMoney(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) */
-		SetDParam64(0, (uint64)_economy.max_loan);
+		SetDParamMoney(0, _economy.max_loan);
 		DrawString(202, y + 10, STR_MAX_LOAN, 0);
 	} else {
 		y = 15;
 	}
 
 	DrawString(2, y, STR_7026_BANK_BALANCE, 0);
-	SetDParam64(0, p->player_money);
+	SetDParamMoney(0, p->player_money);
 	DrawStringRightAligned(182, y, STR_7028, 0);
 
 	y += 10;
 
 	DrawString(2, y, STR_7027_LOAN, 0);
-	SetDParam64(0, p->current_loan);
+	SetDParamMoney(0, p->current_loan);
 	DrawStringRightAligned(182, y, STR_7028, 0);
 
 	y += 12;
 
 	GfxFillRect(182 - 75, y - 2, 182, y - 2, 215);
 
-	SetDParam64(0, p->player_money - p->current_loan);
+	SetDParamMoney(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);
 
-			SetDParam64(0, CalculateCompanyValue(p));
+			SetDParamMoney(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);
-		SetDParam(2, p->bankrupt_value);
+		SetDParamMoney(2, p->bankrupt_value);
 		DrawStringMultiCenter(214, 65, STR_705B_WE_ARE_LOOKING_FOR_A_TRANSPORT, 238);
 		break;
 	}
--- a/src/players.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/players.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -178,7 +178,7 @@
 	if (cost.GetCost() > 0) {
 		PlayerID pid = _current_player;
 		if (IsValidPlayer(pid) && cost.GetCost() > GetPlayer(pid)->player_money) {
-			SetDParam(0, cost.GetCost());
+			SetDParamMoney(0, cost.GetCost());
 			_error_message = STR_0003_NOT_ENOUGH_CASH_REQUIRES;
 			return false;
 		}
--- a/src/roadveh_gui.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/roadveh_gui.cpp	Thu Jun 21 14:54:51 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);
-			SetDParam(3, RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running >> 8);
+			SetDParamMoney(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 */
 		{
-			SetDParam(0, v->profit_this_year);
-			SetDParam(1, v->profit_last_year);
+			SetDParamMoney(0, v->profit_this_year);
+			SetDParamMoney(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);
-		SetDParam(2, v->value);
+		SetDParamMoney(2, v->value);
 		DrawString(34, 57 + y_offset, STR_9011_BUILT_VALUE, 0);
 
 		if (RoadVehHasArticPart(v)) {
@@ -182,7 +182,7 @@
 		}
 
 		/* Draw Transfer credits text */
-		SetDParam(0, v->cargo_feeder_share);
+		SetDParamMoney(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 14:32:27 2007 +0000
+++ b/src/ship_gui.cpp	Thu Jun 21 14:54:51 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);
-			SetDParam(3, ShipVehInfo(v->engine_type)->running_cost * _price.ship_running >> 8);
+			SetDParamMoney(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 */
 		{
-			SetDParam(0, v->profit_this_year);
-			SetDParam(1, v->profit_last_year);
+			SetDParamMoney(0, v->profit_this_year);
+			SetDParamMoney(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));
-		SetDParam(2, v->value);
+		SetDParamMoney(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 */
-		SetDParam(0, v->cargo_feeder_share);
+		SetDParamMoney(0, v->cargo_feeder_share);
 		DrawString(74, 89, STR_FEEDER_CARGO_VALUE, 0);
 
 	} break;
--- a/src/town_gui.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/town_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -175,7 +175,7 @@
 			int i = WP(w,def_d).data_1;
 
 			if (i != -1) {
-				SetDParam(1, (_price.build_industry >> 8) * _town_action_costs[i]);
+				SetDParamMoney(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 14:32:27 2007 +0000
+++ b/src/train_cmd.cpp	Thu Jun 21 14:54:51 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) {
-				SetDParam(1, v->profit_this_year);
+				SetDParamMoney(1, v->profit_this_year);
 				SetDParam(0, v->unitnumber);
 				AddNewsItem(
 					STR_TRAIN_IS_UNPROFITABLE,
--- a/src/train_gui.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/train_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -345,12 +345,12 @@
 {
 	if (RailVehInfo(v->engine_type)->railveh_type == RAILVEH_WAGON) {
 		SetDParam(0, GetCustomEngineName(v->engine_type));
-		SetDParam(1, v->value);
+		SetDParamMoney(1, v->value);
 		DrawString(x, y, STR_882D_VALUE, 0x10);
 	} else {
 		SetDParam(0, GetCustomEngineName(v->engine_type));
 		SetDParam(1, v->build_year);
-		SetDParam(2, v->value);
+		SetDParamMoney(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);
-	SetDParam(3, GetTrainRunningCost(v) >> 8);
+	SetDParamMoney(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);
 
-	SetDParam(0, v->profit_this_year);
-	SetDParam(1, v->profit_last_year);
+	SetDParamMoney(0, v->profit_this_year);
+	SetDParamMoney(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);
 			}
 		}
-		SetDParam(0, v->cargo_feeder_share);
+		SetDParamMoney(0, v->cargo_feeder_share);
 		DrawString(x, y + 15, STR_FEEDER_CARGO_VALUE, 0);
 	}
 }
--- a/src/variables.h	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/variables.h	Thu Jun 21 14:54:51 2007 +0000
@@ -367,6 +367,8 @@
 	_decode_parameters[n + 1] = v >> 32;
 }
 
+static inline void SetDParamMoney(uint n, Money m) { SetDParam64(n, (uint64)m); }
+
 static inline uint32 GetDParam(uint n)
 {
 	assert(n < lengthof(_decode_parameters));
--- a/src/vehicle_gui.cpp	Thu Jun 21 14:32:27 2007 +0000
+++ b/src/vehicle_gui.cpp	Thu Jun 21 14:54:51 2007 +0000
@@ -346,7 +346,7 @@
 				if (CmdSucceeded(cost)) {
 					SetDParam(0, WP(w, refit_d).cargo->cargo);
 					SetDParam(1, _returned_refit_capacity);
-					SetDParam(2, cost.GetCost());
+					SetDParamMoney(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;
 
-		SetDParam(0, v->profit_this_year);
-		SetDParam(1, v->profit_last_year);
+		SetDParamMoney(0, v->profit_this_year);
+		SetDParamMoney(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);