summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-21 17:25:17 +0000
committerrubidium <rubidium@openttd.org>2007-06-21 17:25:17 +0000
commit9c0944aa09b1d36a60d81c41088a906064086bfb (patch)
tree9b6fd14e50d7ab0c8fb901cfad2e00092a6b0470
parentc5225992c168b3546d37f5309b668d9fe5f4af1d (diff)
downloadopenttd-9c0944aa09b1d36a60d81c41088a906064086bfb.tar.xz
(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.
-rw-r--r--src/aircraft_gui.cpp10
-rw-r--r--src/bridge_gui.cpp2
-rw-r--r--src/build_vehicle_gui.cpp18
-rw-r--r--src/command.cpp2
-rw-r--r--src/economy.cpp2
-rw-r--r--src/engine_gui.cpp16
-rw-r--r--src/graph_gui.cpp2
-rw-r--r--src/group_gui.cpp4
-rw-r--r--src/industry_gui.cpp2
-rw-r--r--src/main_gui.cpp2
-rw-r--r--src/misc_cmd.cpp4
-rw-r--r--src/misc_gui.cpp12
-rw-r--r--src/network/network_gui.cpp6
-rw-r--r--src/openttd.h2
-rw-r--r--src/player_gui.cpp16
-rw-r--r--src/players.cpp2
-rw-r--r--src/roadveh_gui.cpp10
-rw-r--r--src/ship_gui.cpp10
-rw-r--r--src/strings.cpp65
-rw-r--r--src/town_gui.cpp2
-rw-r--r--src/train_cmd.cpp2
-rw-r--r--src/train_gui.cpp12
-rw-r--r--src/tunnel_map.cpp2
-rw-r--r--src/tunnel_map.h1
-rw-r--r--src/tunnelbridge_cmd.cpp10
-rw-r--r--src/variables.h23
-rw-r--r--src/vehicle_gui.cpp6
27 files changed, 120 insertions, 125 deletions
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp
index a9e647a7d..b63365361 100644
--- a/src/aircraft_gui.cpp
+++ b/src/aircraft_gui.cpp
@@ -92,7 +92,7 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
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 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
/* 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 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
/* 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 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
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;
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index c850d6d2c..238ac1698 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -47,7 +47,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
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);
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 16b6d5df8..94647881d 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -434,7 +434,7 @@ static const StringID _sort_listing[][11] = {{
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 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
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 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
}
/* 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 @@ static int DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number, const R
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 DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number, const R
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 @@ static int DrawShipPurchaseInfo(int x, int y, EngineID engine_number, const Ship
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 @@ static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const
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 @@ static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const
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;
diff --git a/src/command.cpp b/src/command.cpp
index ce138c4f2..3aa93777c 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -569,7 +569,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
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;
}
diff --git a/src/economy.cpp b/src/economy.cpp
index 9c55781d2..62240444d 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1783,7 +1783,7 @@ static void DoAcquireCompany(Player *p)
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 */
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index e601e5162..b2446fbe3 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -120,12 +120,12 @@ static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
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 DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
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 @@ static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
{
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 DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
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);
}
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 152c66f43..bf4b3aa52 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -162,7 +162,7 @@ static void DrawGraph(const GraphDrawer *gw)
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;
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index b7b15a81e..4d19ba925 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -461,8 +461,8 @@ static void GroupWndProc(Window *w, WindowEvent *e)
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)) {
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 4eb80d87e..dca4ef7ac 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -39,7 +39,7 @@ static void BuildIndustryWndProc(Window *w, WindowEvent *e)
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;
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 4c468dc1a..0d923b600 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -2208,7 +2208,7 @@ static void StatusBarWndProc(Window *w, WindowEvent *e)
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);
}
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp
index ac546aa08..5ad8ffc24 100644
--- a/src/misc_cmd.cpp
+++ b/src/misc_cmd.cpp
@@ -129,7 +129,7 @@ CommandCost CmdIncreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
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 @@ CommandCost CmdDecreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
if (p->player_money < loan) {
- SetDParamMoney(0, loan);
+ SetDParam(0, loan);
return_cmd_error(STR_702E_REQUIRED);
}
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 1a5b9bbd8..2a36406af 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -122,7 +122,7 @@ static void Place_LandInfo(TileIndex tile)
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 @@ void ShowBuildTreesScenToolbar()
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 @@ void ShowEstimatedCostOrIncome(Money cost, int x, int y)
cost = -cost;
msg = STR_0807_ESTIMATED_INCOME;
}
- SetDParamMoney(0, cost);
+ SetDParam(0, cost);
ShowErrorMessage(INVALID_STRING_ID, msg, x, y);
}
@@ -632,7 +632,7 @@ void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
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 @@ void ShowFeederIncomeAnimation(int x, int y, int z, Money cost)
{
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 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
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);
}
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 112efdf73..10fa2b4dd 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -894,15 +894,15 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
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;
diff --git a/src/openttd.h b/src/openttd.h
index 6f2b1556c..fda9893d6 100644
--- a/src/openttd.h
+++ b/src/openttd.h
@@ -353,7 +353,7 @@ struct TileDesc {
StringID str;
Owner owner;
Date build_date;
- uint32 dparam[2];
+ uint64 dparam[2];
};
struct ViewportSign {
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index 7324e097e..ae9695dfa 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -60,14 +60,14 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode)
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 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode)
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 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
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 @@ static void BuyCompanyWndProc(Window *w, WindowEvent *e)
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;
}
diff --git a/src/players.cpp b/src/players.cpp
index 9a4f61ce1..56c117c94 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -178,7 +178,7 @@ bool CheckPlayerHasMoney(CommandCost cost)
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;
}
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index 34ecf19ff..a07203f0b 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -92,7 +92,7 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
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 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
/* 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 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
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 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
}
/* 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 */
diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp
index 670edc0ed..4cca7e17d 100644
--- a/src/ship_gui.cpp
+++ b/src/ship_gui.cpp
@@ -50,7 +50,7 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
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 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
/* 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 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
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 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
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;
diff --git a/src/strings.cpp b/src/strings.cpp
index 94c937e4f..62334da1d 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -38,9 +38,9 @@ char _userstring[128];
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 @@ static uint _langtab_start[32]; // Offset into langpack offs
/** Read an int64 from the argv array. */
-static inline int64 GetInt64(const int32 **argv)
+static inline int64 GetInt64(const int64 **argv)
{
- int64 result;
-
assert(argv);
- result = (uint32)(*argv)[0] + ((uint64)(uint32)(*argv)[1] << 32);
- (*argv) += 2;
- return result;
+ return *(*argv)++;
}
/** Read an int32 from the argv array. */
-static inline int32 GetInt32(const int32 **argv)
+static inline int32 GetInt32(const int64 **argv)
{
- assert(argv);
- return *(*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 @@ static const char *GetStringPtr(StringID string)
* @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 @@ static char *GetStringWithArgs(char *buffr, uint string, const int32 *argv, cons
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 @@ static char *FormatYmdString(char *buff, Date date, const char* last)
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 @@ static char *FormatMonthAndYear(char *buff, Date date, const char* last)
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 @@ static char *FormatTinyDate(char *buff, Date date, const char* last)
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 const Units units[] = {
},
};
-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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
}
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
}
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
}
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
}
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
}
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
}
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
}
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
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 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
case SCC_TOWN_NAME: { // {TOWN}
const Town* t = GetTown(GetInt32(&argv));
- int32 temp[1];
+ int64 temp[1];
assert(IsValidTown(t));
@@ -862,7 +857,7 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
case SCC_GROUP_NAME: { // {GROUP}
const Group *g = GetGroup(GetInt32(&argv));
- int32 args[1];
+ int64 args[1];
assert(IsValidGroup(g));
@@ -1046,7 +1041,7 @@ static char *GenPresidentName(char *buff, uint32 x, const char* last)
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
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 8cb690c6b..bb46c0c17 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -175,7 +175,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
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);
}
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 228ccfb02..1d5a88877 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -3422,7 +3422,7 @@ void TrainsYearlyLoop()
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,
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index d8bc63231..1a1a475c8 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -345,12 +345,12 @@ static void TrainDetailsInfoTab(const Vehicle *v, int x, int y)
{
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 @@ static void DrawTrainDetailsWindow(Window *w)
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 @@ static void DrawTrainDetailsWindow(Window *w)
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 @@ static void DrawTrainDetailsWindow(Window *w)
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);
}
}
diff --git a/src/tunnel_map.cpp b/src/tunnel_map.cpp
index d0788b951..8d75735b6 100644
--- a/src/tunnel_map.cpp
+++ b/src/tunnel_map.cpp
@@ -39,7 +39,7 @@ TileIndex GetOtherTunnelEnd(TileIndex tile)
* @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;
diff --git a/src/tunnel_map.h b/src/tunnel_map.h
index 66d5bcd10..8396ae2c9 100644
--- a/src/tunnel_map.h
+++ b/src/tunnel_map.h
@@ -87,6 +87,7 @@ static inline void SetTunnelSnowOrDesert(TileIndex t, bool snow_or_desert)
TileIndex GetOtherTunnelEnd(TileIndex);
bool IsTunnelInWay(TileIndex, uint z);
+bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir);
/**
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index c705bb28d..ce2a0a380 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -491,6 +491,13 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32
* 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 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32
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);
diff --git a/src/variables.h b/src/variables.h
index 761f5f2a3..8a4067ba9 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -289,7 +289,7 @@ VARDEF bool _news_ticker_sound;
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 *_highscore_file;
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 @@ void SetDParamStr(uint n, const char *str);
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;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index c90c490bf..b9bd7bb31 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -346,7 +346,7 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e)
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 @@ static void DrawVehicleListWindow(Window *w)
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);