Fix crash which could occur when adjusting train lengths for old saves

e.g. due to only partially initialised timetable
This commit is contained in:
Jonathan G Rennison
2023-11-18 13:41:19 +00:00
parent 9c29950956
commit 35d1955db0

View File

@@ -3216,9 +3216,6 @@ bool AfterLoadGame()
} }
} }
/* The center of train vehicles was changed, fix up spacing. */
if (IsSavegameVersionBefore(SLV_164)) FixupTrainLengths();
if (IsSavegameVersionBefore(SLV_165)) { if (IsSavegameVersionBefore(SLV_165)) {
for (Town *t : Town::Iterate()) { for (Town *t : Town::Iterate()) {
/* Set the default cargo requirement for town growth */ /* Set the default cargo requirement for town growth */
@@ -4271,6 +4268,12 @@ bool AfterLoadGame()
} }
} }
/*
* The center of train vehicles was changed, fix up spacing.
* Delay this until all train and track updates have been performed.
*/
if (IsSavegameVersionBefore(SLV_164)) FixupTrainLengths();
InitializeRoadGUI(); InitializeRoadGUI();
/* This needs to be done after conversion. */ /* This needs to be done after conversion. */