Fix 81062163: for (really) old games, station bus/truck station cache was not updated #9366
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Problem
So I was doing the following:
For a huge set of savegames, ranging from 0.3 up til 1.11.2, do this:
I did this to validate "Afterload", that we are doing the right thing in all cases.
Turns out .. 12 years ago we made a boo-boo, and we do not do the right thing in all cases :)
Description
In 8106216 we introduced a station cache, where we know the area the bus/truck-stations are within. This cache is generated in
AfterloadStations
. Unaware to the writer of that change,AfterloadStations
is not -always- loaded when loading old games. Specifically, if the version is pre-27, it is not executed. So for those savegames, the cache value was never correctly calculated.This means that in the above example, you see, sometimes even after a few ticks, that road vehicles start to make different decisions. One thinks he reached the station, the other thinks he did not.
As it turns out,
AfterloadStations
is called in many other places too, mostly when there is any change to the NewGRF configuration. So clearly it is fine to call this function unconditionally, and indeed, by removing the version-check, the whole test-set validates a lot better. (still some issues, but not for this PR).Version 27 is the 0.4.X series, for context.
Limitations
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.