Fix #12010: Use economy timer for vehicle stats minimum age, not calendar (#12142)

This commit is contained in:
Tyler Trahan
2024-03-09 09:38:52 -05:00
committed by Kuhnovic
parent b4f72e6ce6
commit a3ce25b487
13 changed files with 42 additions and 15 deletions

View File

@@ -398,6 +398,13 @@ void AfterLoadVehicles(bool part_of_load)
v->timetable_start = GetStartTickFromDate(v->timetable_start);
}
}
if (IsSavegameVersionBefore(SLV_VEHICLE_ECONOMY_AGE)) {
/* Set vehicle economy age based on calendar age. */
for (Vehicle *v : Vehicle::Iterate()) {
v->economy_age = v->age.base();
}
}
}
CheckValidVehicles();
@@ -718,6 +725,7 @@ public:
SLE_CONDVAR(Vehicle, age, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
SLE_CONDVAR(Vehicle, age, SLE_INT32, SLV_31, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, economy_age, SLE_INT32, SLV_VEHICLE_ECONOMY_AGE, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, max_age, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
SLE_CONDVAR(Vehicle, max_age, SLE_INT32, SLV_31, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, date_of_last_service, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),