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

@@ -1482,6 +1482,7 @@ static CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const
v->railtype = rvi->railtype;
v->date_of_last_service = _date;
v->date_of_last_service_newgrf = _date;
v->build_year = _cur_year;
v->sprite_seq.Set(SPR_IMG_QUERY);
v->random_bits = Random();
@@ -1557,6 +1558,7 @@ static void AddRearEngineToMultiheadedTrain(Train *v)
u->reliability = v->reliability;
u->reliability_spd_dec = v->reliability_spd_dec;
u->date_of_last_service = v->date_of_last_service;
u->date_of_last_service_newgrf = v->date_of_last_service_newgrf;
u->build_year = v->build_year;
u->sprite_seq.Set(SPR_IMG_QUERY);
u->random_bits = Random();
@@ -1626,6 +1628,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, const Engin
v->SetServiceInterval(Company::Get(_current_company)->settings.vehicle.servint_trains);
v->date_of_last_service = _date;
v->date_of_last_service_newgrf = _date;
v->build_year = _cur_year;
v->sprite_seq.Set(SPR_IMG_QUERY);
v->random_bits = Random();