Codechange: Add a DateToYear function instead of dividing each time (#11173)

This commit is contained in:
Tyler Trahan
2023-08-11 08:19:54 -04:00
committed by GitHub
parent 4928ccf916
commit 6190f48df0
4 changed files with 15 additions and 5 deletions

View File

@@ -2495,9 +2495,9 @@ struct VehicleDetailsWindow : Window {
Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
/* Draw running cost */
SetDParam(1, v->age / DAYS_IN_LEAP_YEAR);
SetDParam(1, DateToYear(v->age));
SetDParam(0, (v->age + DAYS_IN_YEAR < v->max_age) ? STR_VEHICLE_INFO_AGE : STR_VEHICLE_INFO_AGE_RED);
SetDParam(2, v->max_age / DAYS_IN_LEAP_YEAR);
SetDParam(2, DateToYear(v->max_age));
SetDParam(3, v->GetDisplayRunningCost());
DrawString(tr, STR_VEHICLE_INFO_AGE_RUNNING_COST_YR);
tr.top += FONT_HEIGHT_NORMAL;