Fix #10334: Store separate newgrf-safe version of date_of_last_service. (#11124)

This value is not changed when the date cheat is used, which caused issues with changing properties based on service date.

Co-authored-by: Peter Nelson <peter1138@openttd.org>
(cherry picked from commit 9a602ff304)
This commit is contained in:
Tyler Trahan
2023-08-06 12:57:10 -04:00
committed by Jonathan G Rennison
parent 5bcc71f2c2
commit b012d1100c
14 changed files with 27 additions and 3 deletions

View File

@@ -4222,6 +4222,13 @@ bool AfterLoadGame()
GenerateSavegameId();
}
if (IsSavegameVersionBefore(SLV_NEWGRF_LAST_SERVICE) && SlXvIsFeatureMissing(XSLFI_NEWGRF_LAST_SERVICE)) {
/* Set service date provided to NewGRF. */
for (Vehicle *v : Vehicle::Iterate()) {
v->date_of_last_service_newgrf = v->date_of_last_service;
}
}
InitializeRoadGUI();
/* This needs to be done after conversion. */