Codechange: Compose engine preview text from multiple strings.

pull/661/head
frosch 5 months ago committed by frosch
parent 68c64d2511
commit abfeeea849

@ -170,22 +170,24 @@ uint GetTotalCapacityOfArticulatedParts(EngineID engine)
static StringID GetTrainEngineInfoString(const Engine *e)
{
SetDParam(0, e->GetCost());
SetDParam(2, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
SetDParam(3, e->GetPower());
SetDParam(1, e->GetDisplayWeight());
SetDParam(7, e->GetDisplayMaxTractiveEffort());
SetDParam(0, STR_ENGINE_PREVIEW_COST_WEIGHT);
SetDParam(1, e->GetCost());
SetDParam(2, e->GetDisplayWeight());
SetDParam(3, (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL && GetRailTypeInfo(e->u.rail.railtype)->acceleration_type != 2) ? STR_ENGINE_PREVIEW_SPEED_POWER_MAX_TE : STR_ENGINE_PREVIEW_SPEED_POWER);
SetDParam(4, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
SetDParam(5, e->GetPower());
SetDParam(6, e->GetDisplayMaxTractiveEffort());
SetDParam(4, e->GetRunningCost());
SetDParam(7, TimerGameEconomy::UsingWallclockUnits() ? STR_ENGINE_PREVIEW_RUNCOST_PERIOD : STR_ENGINE_PREVIEW_RUNCOST_YEAR);
SetDParam(8, e->GetRunningCost());
SetDParam(9, STR_ENGINE_PREVIEW_CAPACITY);
uint capacity = GetTotalCapacityOfArticulatedParts(e->index);
if (capacity != 0) {
SetDParam(5, e->GetDefaultCargoType());
SetDParam(6, capacity);
} else {
SetDParam(5, INVALID_CARGO);
}
return (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL && GetRailTypeInfo(e->u.rail.railtype)->acceleration_type != 2) ? STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER_MAX_TE : STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER;
SetDParam(10, capacity != 0 ? e->GetDefaultCargoType() : INVALID_CARGO);
SetDParam(11, capacity);
return STR_ENGINE_PREVIEW_TEXT4;
}
static StringID GetAircraftEngineInfoString(const Engine *e)
@ -195,67 +197,70 @@ static StringID GetAircraftEngineInfoString(const Engine *e)
uint capacity = e->GetDisplayDefaultCapacity(&mail_capacity);
uint16_t range = e->GetRange();
uint i = 0;
SetDParam(i++, e->GetCost());
SetDParam(i++, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
SetDParam(i++, e->GetAircraftTypeText());
if (range > 0) SetDParam(i++, range);
SetDParam(i++, cargo);
SetDParam(i++, capacity);
if (mail_capacity > 0) {
SetDParam(i++, CT_MAIL);
SetDParam(i++, mail_capacity);
SetDParam(i++, e->GetRunningCost());
return range > 0 ? STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_RANGE_CAP_CAP_RUNCOST : STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_CAP_CAP_RUNCOST;
} else {
SetDParam(i++, e->GetRunningCost());
return range > 0 ? STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_RANGE_CAP_RUNCOST : STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_CAP_RUNCOST;
}
SetDParam(0, STR_ENGINE_PREVIEW_COST_MAX_SPEED);
SetDParam(1, e->GetCost());
SetDParam(2, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
SetDParam(3, range > 0 ? STR_ENGINE_PREVIEW_TYPE_RANGE : STR_ENGINE_PREVIEW_TYPE);
SetDParam(4, e->GetAircraftTypeText());
SetDParam(5, range);
SetDParam(7, TimerGameEconomy::UsingWallclockUnits() ? STR_ENGINE_PREVIEW_RUNCOST_PERIOD : STR_ENGINE_PREVIEW_RUNCOST_YEAR);
SetDParam(8, e->GetRunningCost());
SetDParam(9, mail_capacity > 0 ? STR_ENGINE_PREVIEW_CAPACITY_2 : STR_ENGINE_PREVIEW_CAPACITY);
SetDParam(10, cargo);
SetDParam(11, capacity);
SetDParam(12, CT_MAIL);
SetDParam(13, mail_capacity);
return STR_ENGINE_PREVIEW_TEXT4;
}
static StringID GetRoadVehEngineInfoString(const Engine *e)
{
SetDParam(7, TimerGameEconomy::UsingWallclockUnits() ? STR_ENGINE_PREVIEW_RUNCOST_PERIOD : STR_ENGINE_PREVIEW_RUNCOST_YEAR);
SetDParam(8, e->GetRunningCost());
SetDParam(9, STR_ENGINE_PREVIEW_CAPACITY);
uint capacity = GetTotalCapacityOfArticulatedParts(e->index);
SetDParam(10, capacity != 0 ? e->GetDefaultCargoType() : INVALID_CARGO);
SetDParam(11, capacity);
if (_settings_game.vehicle.roadveh_acceleration_model == AM_ORIGINAL) {
SetDParam(0, e->GetCost());
SetDParam(1, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
uint capacity = GetTotalCapacityOfArticulatedParts(e->index);
if (capacity != 0) {
SetDParam(2, e->GetDefaultCargoType());
SetDParam(3, capacity);
} else {
SetDParam(2, INVALID_CARGO);
}
SetDParam(4, e->GetRunningCost());
return STR_ENGINE_PREVIEW_COST_MAX_SPEED_CAP_RUNCOST;
} else {
SetDParam(0, e->GetCost());
SetDParam(0, STR_ENGINE_PREVIEW_COST_MAX_SPEED);
SetDParam(1, e->GetCost());
SetDParam(2, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
SetDParam(3, e->GetPower());
SetDParam(1, e->GetDisplayWeight());
SetDParam(7, e->GetDisplayMaxTractiveEffort());
SetDParam(4, e->GetRunningCost());
uint capacity = GetTotalCapacityOfArticulatedParts(e->index);
if (capacity != 0) {
SetDParam(5, e->GetDefaultCargoType());
SetDParam(6, capacity);
} else {
SetDParam(5, INVALID_CARGO);
}
return STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER_MAX_TE;
return STR_ENGINE_PREVIEW_TEXT3;
} else {
SetDParam(0, STR_ENGINE_PREVIEW_COST_WEIGHT);
SetDParam(1, e->GetCost());
SetDParam(2, e->GetDisplayWeight());
SetDParam(3, STR_ENGINE_PREVIEW_SPEED_POWER_MAX_TE);
SetDParam(4, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
SetDParam(5, e->GetPower());
SetDParam(6, e->GetDisplayMaxTractiveEffort());
return STR_ENGINE_PREVIEW_TEXT4;
}
}
static StringID GetShipEngineInfoString(const Engine *e)
{
SetDParam(0, e->GetCost());
SetDParam(1, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
SetDParam(2, e->GetDefaultCargoType());
SetDParam(3, e->GetDisplayDefaultCapacity());
SetDParam(4, e->GetRunningCost());
return STR_ENGINE_PREVIEW_COST_MAX_SPEED_CAP_RUNCOST;
SetDParam(0, STR_ENGINE_PREVIEW_COST_MAX_SPEED);
SetDParam(1, e->GetCost());
SetDParam(2, PackVelocity(e->GetDisplayMaxSpeed(), e->type));
SetDParam(7, TimerGameEconomy::UsingWallclockUnits() ? STR_ENGINE_PREVIEW_RUNCOST_PERIOD : STR_ENGINE_PREVIEW_RUNCOST_YEAR);
SetDParam(8, e->GetRunningCost());
SetDParam(9, STR_ENGINE_PREVIEW_CAPACITY);
SetDParam(10, e->GetDefaultCargoType());
SetDParam(11, e->GetDisplayDefaultCapacity());
return STR_ENGINE_PREVIEW_TEXT3;
}

@ -4253,13 +4253,18 @@ STR_ENGINE_PREVIEW_TRAM_VEHICLE :tramway vehicle
STR_ENGINE_PREVIEW_AIRCRAFT :aircraft
STR_ENGINE_PREVIEW_SHIP :ship
STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER :{BLACK}Cost: {CURRENCY_LONG} Weight: {WEIGHT_SHORT}{}Speed: {VELOCITY} Power: {POWER}{}Running Cost: {CURRENCY_LONG}/{TKM year period}{}Capacity: {CARGO_LONG}
STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER_MAX_TE :{BLACK}Cost: {0:CURRENCY_LONG} Weight: {1:WEIGHT_SHORT}{}Speed: {2:VELOCITY} Power: {3:POWER} Max. T.E.: {6:FORCE}{}Running Cost: {4:CURRENCY_LONG}/{TKM year period}{}Capacity: {5:CARGO_LONG}
STR_ENGINE_PREVIEW_COST_MAX_SPEED_CAP_RUNCOST :{BLACK}Cost: {CURRENCY_LONG} Max. Speed: {VELOCITY}{}Capacity: {CARGO_LONG}{}Running Cost: {CURRENCY_LONG}/{TKM year period}
STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_CAP_CAP_RUNCOST :{BLACK}Cost: {CURRENCY_LONG} Max. Speed: {VELOCITY}{}Aircraft type: {STRING}{}Capacity: {CARGO_LONG}, {CARGO_LONG}{}Running Cost: {CURRENCY_LONG}/{TKM year period}
STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_CAP_RUNCOST :{BLACK}Cost: {CURRENCY_LONG} Max. Speed: {VELOCITY}{}Aircraft type: {STRING}{}Capacity: {CARGO_LONG}{}Running Cost: {CURRENCY_LONG}/{TKM year period}
STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_RANGE_CAP_CAP_RUNCOST :{BLACK}Cost: {CURRENCY_LONG} Max. Speed: {VELOCITY}{}Aircraft type: {STRING} Range: {COMMA} tiles{}Capacity: {CARGO_LONG}, {CARGO_LONG}{}Running Cost: {CURRENCY_LONG}/{TKM year period}
STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_RANGE_CAP_RUNCOST :{BLACK}Cost: {CURRENCY_LONG} Max. Speed: {VELOCITY}{}Aircraft type: {STRING} Range: {COMMA} tiles{}Capacity: {CARGO_LONG}{}Running Cost: {CURRENCY_LONG}/{TKM year period}
STR_ENGINE_PREVIEW_TEXT3 :{BLACK}{STRING2}{}{5:STRING1}{}{STRING4}
STR_ENGINE_PREVIEW_TEXT4 :{BLACK}{STRING2}{}{STRING3}{}{STRING1}{}{STRING4}
STR_ENGINE_PREVIEW_COST_WEIGHT :Cost: {CURRENCY_LONG} Weight: {WEIGHT_SHORT}
STR_ENGINE_PREVIEW_COST_MAX_SPEED :Cost: {CURRENCY_LONG} Max. Speed: {VELOCITY}
STR_ENGINE_PREVIEW_SPEED_POWER :Speed: {VELOCITY} Power: {POWER}
STR_ENGINE_PREVIEW_SPEED_POWER_MAX_TE :Speed: {VELOCITY} Power: {POWER} Max. T.E.: {FORCE}
STR_ENGINE_PREVIEW_TYPE :Aircraft type: {STRING}
STR_ENGINE_PREVIEW_TYPE_RANGE :Aircraft type: {STRING} Range: {COMMA} tiles
STR_ENGINE_PREVIEW_RUNCOST_YEAR :Running Cost: {CURRENCY_LONG}/year
STR_ENGINE_PREVIEW_RUNCOST_PERIOD :Running Cost: {CURRENCY_LONG}/period
STR_ENGINE_PREVIEW_CAPACITY :Capacity: {CARGO_LONG}
STR_ENGINE_PREVIEW_CAPACITY_2 :Capacity: {CARGO_LONG}, {CARGO_LONG}
# Autoreplace window
STR_REPLACE_VEHICLES_WHITE :{WHITE}Replace {STRING} - {STRING1}

Loading…
Cancel
Save