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

@@ -967,7 +967,7 @@ int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number,
if (e->type != VEH_TRAIN || e->u.rail.railveh_type != RAILVEH_WAGON) {
/* Design date - Life length */
SetDParam(0, ymd.year);
SetDParam(1, e->GetLifeLengthInDays() / DAYS_IN_LEAP_YEAR);
SetDParam(1, DateToYear(e->GetLifeLengthInDays()));
DrawString(left, right, y, STR_PURCHASE_INFO_DESIGNED_LIFE);
y += FONT_HEIGHT_NORMAL;