diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 16e5d75ad3..09ac34f811 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -790,6 +790,8 @@ static StringID GetRunningCostString() { if (EconTime::UsingWallclockUnits()) { return STR_PURCHASE_INFO_RUNNINGCOST_PERIOD; + } else if (DayLengthFactor() > 1) { + return STR_PURCHASE_INFO_RUNNINGCOST_ORIG_YEAR; } else { return STR_PURCHASE_INFO_RUNNINGCOST_YEAR; } diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index 967874d75a..8b7a0e896f 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -206,6 +206,8 @@ static StringID GetRunningCostString() { if (EconTime::UsingWallclockUnits()) { return STR_ENGINE_PREVIEW_RUNCOST_PERIOD; + } else if (DayLengthFactor() > 1) { + return STR_ENGINE_PREVIEW_RUNCOST_ORIG_YEAR; } else { return STR_ENGINE_PREVIEW_RUNCOST_YEAR; } diff --git a/src/lang/extra/english.txt b/src/lang/extra/english.txt index 721f4d643f..310f634de9 100644 --- a/src/lang/extra/english.txt +++ b/src/lang/extra/english.txt @@ -1507,6 +1507,7 @@ STR_BUY_VEHICLE_TRAIN_LOCOMOTIVES :Locomotives and STR_BUY_VEHICLE_TRAIN_WAGONS :Wagons 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_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_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_WEIGHT_RATIOS :{STRING1} {STRING1} 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_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_GROUP :{BLACK}Group: {LTBLUE}{GROUP} diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 3c0d5ef40b..a9a98e87a1 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -693,7 +693,7 @@ public: * Gets the running cost of a vehicle that can be sent into SetDParam for string processing. * @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. diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index a532d43882..bae472c32a 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -3001,7 +3001,7 @@ struct VehicleDetailsWindow : Window { dim = maxdim(dim, GetStringBoundingBox(STR_VEHICLE_INFO_WEIGHT_RATIOS)); } 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; break; } @@ -3102,6 +3102,17 @@ struct VehicleDetailsWindow : Window { 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 { 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(2, DateDeltaToYearDelta(v->max_age)); SetDParam(3, v->GetDisplayRunningCost()); - DrawString(tr, STR_VEHICLE_INFO_AGE_RUNNING_COST_YR); + DrawString(tr, this->GetRunningCostString()); tr.top += GetCharacterHeight(FS_NORMAL); /* Draw max speed */