Do not scale shown running costs by the day length factor

Show in original years
This commit is contained in:
Jonathan G Rennison
2024-02-16 18:41:53 +00:00
parent 3ec77973df
commit b940fa9466
5 changed files with 23 additions and 3 deletions

View File

@@ -790,6 +790,8 @@ static StringID GetRunningCostString()
{ {
if (EconTime::UsingWallclockUnits()) { if (EconTime::UsingWallclockUnits()) {
return STR_PURCHASE_INFO_RUNNINGCOST_PERIOD; return STR_PURCHASE_INFO_RUNNINGCOST_PERIOD;
} else if (DayLengthFactor() > 1) {
return STR_PURCHASE_INFO_RUNNINGCOST_ORIG_YEAR;
} else { } else {
return STR_PURCHASE_INFO_RUNNINGCOST_YEAR; return STR_PURCHASE_INFO_RUNNINGCOST_YEAR;
} }

View File

@@ -206,6 +206,8 @@ static StringID GetRunningCostString()
{ {
if (EconTime::UsingWallclockUnits()) { if (EconTime::UsingWallclockUnits()) {
return STR_ENGINE_PREVIEW_RUNCOST_PERIOD; return STR_ENGINE_PREVIEW_RUNCOST_PERIOD;
} else if (DayLengthFactor() > 1) {
return STR_ENGINE_PREVIEW_RUNCOST_ORIG_YEAR;
} else { } else {
return STR_ENGINE_PREVIEW_RUNCOST_YEAR; return STR_ENGINE_PREVIEW_RUNCOST_YEAR;
} }

View File

@@ -1507,6 +1507,7 @@ STR_BUY_VEHICLE_TRAIN_LOCOMOTIVES :Locomotives and
STR_BUY_VEHICLE_TRAIN_WAGONS :Wagons STR_BUY_VEHICLE_TRAIN_WAGONS :Wagons
STR_PURCHASE_INFO_DESIGNED :{BLACK}Designed: {GOLD}{NUM} STR_PURCHASE_INFO_DESIGNED :{BLACK}Designed: {GOLD}{NUM}
STR_PURCHASE_INFO_RUNNINGCOST_ORIG_YEAR :{BLACK}Running Cost: {GOLD}{CURRENCY_LONG}/original year
STR_BUY_REFIT_VEHICLE_BUY_VEHICLE_BUTTON :{BLACK}Refit after buy STR_BUY_REFIT_VEHICLE_BUY_VEHICLE_BUTTON :{BLACK}Refit after buy
STR_BUY_REFIT_VEHICLE_BUY_VEHICLE_TOOLTIP :{BLACK}Automatically refit the highlighted vehicle after buying to selected cargo type STR_BUY_REFIT_VEHICLE_BUY_VEHICLE_TOOLTIP :{BLACK}Automatically refit the highlighted vehicle after buying to selected cargo type
@@ -1564,6 +1565,8 @@ STR_NEED_REPAIR :{ORANGE}Vehicle
STR_CURRENT_STATUS :{BLACK}Current status: {STRING3} STR_CURRENT_STATUS :{BLACK}Current status: {STRING3}
STR_ENGINE_PREVIEW_RUNCOST_ORIG_YEAR :Running Cost: {CURRENCY_LONG}/original year
STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}Train length {LTBLUE}{DECIMAL} tile{P "" s} {STRING4} STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}Train length {LTBLUE}{DECIMAL} tile{P "" s} {STRING4}
STR_VEHICLE_INFO_WEIGHT_RATIOS :{STRING1} {STRING1} STR_VEHICLE_INFO_WEIGHT_RATIOS :{STRING1} {STRING1}
STR_VEHICLE_INFO_POWER_WEIGHT_RATIO :{BLACK}Power / weight: {LTBLUE}{POWER_WEIGHT_RATIO} STR_VEHICLE_INFO_POWER_WEIGHT_RATIO :{BLACK}Power / weight: {LTBLUE}{POWER_WEIGHT_RATIO}
@@ -1571,6 +1574,8 @@ STR_VEHICLE_INFO_TE_WEIGHT_RATIO :{BLACK}Max. T.E
STR_VEHICLE_INFO_FULL_WEIGHT_WITH_RATIOS :{BLACK}Full weight: {LTBLUE}{WEIGHT_SHORT} {STRING4} STR_VEHICLE_INFO_FULL_WEIGHT_WITH_RATIOS :{BLACK}Full weight: {LTBLUE}{WEIGHT_SHORT} {STRING4}
STR_VEHICLE_INFO_MAX_SPEED_LOADED :{BLACK}Max. speed (full): {LTBLUE}{VELOCITY} STR_VEHICLE_INFO_MAX_SPEED_LOADED :{BLACK}Max. speed (full): {LTBLUE}{VELOCITY}
STR_VEHICLE_INFO_AGE_RUNNING_COST_ORIG_YR :{BLACK}Age: {LTBLUE}{STRING2}{BLACK} Running Cost: {LTBLUE}{CURRENCY_LONG}/original year
STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR_LIFETIME :{STRING2} (lifetime: {CURRENCY_LONG}) STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR_LIFETIME :{STRING2} (lifetime: {CURRENCY_LONG})
STR_VEHICLE_INFO_GROUP :{BLACK}Group: {LTBLUE}{GROUP} STR_VEHICLE_INFO_GROUP :{BLACK}Group: {LTBLUE}{GROUP}

View File

@@ -693,7 +693,7 @@ public:
* Gets the running cost of a vehicle that can be sent into SetDParam for string processing. * Gets the running cost of a vehicle that can be sent into SetDParam for string processing.
* @return the vehicle's running cost * @return the vehicle's running cost
*/ */
Money GetDisplayRunningCost() const { return (this->GetRunningCost() >> 8) * DayLengthFactor(); } Money GetDisplayRunningCost() const { return this->GetRunningCost() >> 8; }
/** /**
* Gets the profit vehicle had this year. It can be sent into SetDParam for string processing. * Gets the profit vehicle had this year. It can be sent into SetDParam for string processing.

View File

@@ -3001,7 +3001,7 @@ struct VehicleDetailsWindow : Window {
dim = maxdim(dim, GetStringBoundingBox(STR_VEHICLE_INFO_WEIGHT_RATIOS)); dim = maxdim(dim, GetStringBoundingBox(STR_VEHICLE_INFO_WEIGHT_RATIOS));
} }
SetDParam(0, STR_VEHICLE_INFO_AGE); SetDParam(0, STR_VEHICLE_INFO_AGE);
dim = maxdim(dim, GetStringBoundingBox(STR_VEHICLE_INFO_AGE_RUNNING_COST_YR)); dim = maxdim(dim, GetStringBoundingBox(this->GetRunningCostString()));
size->width = dim.width + padding.width; size->width = dim.width + padding.width;
break; break;
} }
@@ -3102,6 +3102,17 @@ struct VehicleDetailsWindow : Window {
if (widget == WID_VD_CAPTION) SetDParam(0, Vehicle::Get(this->window_number)->index); if (widget == WID_VD_CAPTION) SetDParam(0, Vehicle::Get(this->window_number)->index);
} }
StringID GetRunningCostString() const
{
if (EconTime::UsingWallclockUnits()) {
return STR_VEHICLE_INFO_AGE_RUNNING_COST_PERIOD;
} else if (DayLengthFactor() > 1) {
return STR_VEHICLE_INFO_AGE_RUNNING_COST_ORIG_YR;
} else {
return STR_VEHICLE_INFO_AGE_RUNNING_COST_YR;
}
}
void DrawWidget(const Rect &r, WidgetID widget) const override void DrawWidget(const Rect &r, WidgetID widget) const override
{ {
const Vehicle *v = Vehicle::Get(this->window_number); const Vehicle *v = Vehicle::Get(this->window_number);
@@ -3115,7 +3126,7 @@ struct VehicleDetailsWindow : Window {
SetDParam(0, (v->age + DAYS_IN_YEAR < v->max_age) ? STR_VEHICLE_INFO_AGE : STR_VEHICLE_INFO_AGE_RED); SetDParam(0, (v->age + DAYS_IN_YEAR < v->max_age) ? STR_VEHICLE_INFO_AGE : STR_VEHICLE_INFO_AGE_RED);
SetDParam(2, DateDeltaToYearDelta(v->max_age)); SetDParam(2, DateDeltaToYearDelta(v->max_age));
SetDParam(3, v->GetDisplayRunningCost()); SetDParam(3, v->GetDisplayRunningCost());
DrawString(tr, STR_VEHICLE_INFO_AGE_RUNNING_COST_YR); DrawString(tr, this->GetRunningCostString());
tr.top += GetCharacterHeight(FS_NORMAL); tr.top += GetCharacterHeight(FS_NORMAL);
/* Draw max speed */ /* Draw max speed */