-
-
Notifications
You must be signed in to change notification settings - Fork 968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: CmdFoundTown may cause multiplayer desyncs due to not initialising Town::stations_near #9407
Comments
JGRennison
added a commit
to JGRennison/OpenTTD-patches
that referenced
this issue
Jun 30, 2021
The issue is Lines 2313 to 2318 in a7fabe4
MakeTownHouse() (added with 8b1b3fd) being skipped because Line 1993 in a7fabe4
CmdFoundTown() ( |
TrueBrain
added a commit
to TrueBrain/OpenTTD
that referenced
this issue
Aug 31, 2021
"stations_near" wasn't updated when founding a town near a station. As this variable is not saved, any client joining after the town is founded has a different value for "stations_near", potentially causing desyncs.
TrueBrain
added a commit
to TrueBrain/OpenTTD
that referenced
this issue
Aug 31, 2021
"stations_near" wasn't updated when founding a town near a station. As this variable is not saved, any client joining after the town is founded has a different value for "stations_near", potentially causing desyncs.
Tnx for the analysis @glx22 , that really helped as lot :) @JGRennison : I want for a slightly different solution than your commit, as I explain in #9526. Let me know if you foresee any issue with that. |
TrueBrain
added a commit
to TrueBrain/OpenTTD
that referenced
this issue
Aug 31, 2021
"stations_near" wasn't updated when founding a town near a station. As this variable is not saved, any client joining after the town is founded has a different value for "stations_near", potentially causing desyncs.
TrueBrain
added a commit
to TrueBrain/OpenTTD
that referenced
this issue
Aug 31, 2021
"stations_near" wasn't updated when founding a town near a station. As this variable is not saved, any client joining after the town is founded has a different value for "stations_near", potentially causing desyncs. As the intention of this if() statement was to skip an expensive calculation when there are clearly no stations, better to move that check inside the function, so other places also enjoy the speedup.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version of OpenTTD
master
Expected result
No multiplayer desyncs or incorrect caches
Actual result
CmdFoundTown may be called by the player in game, in the scenario editor, or by a GS.
In the event that a town is founded in range of existing stations (i.e. where one or more new town house tiles are within the station's catchment area), the town's stations_near will be incorrectly empty, instead of containing the stations within range.
In the event that this occurs in multiplayer, players which join after the town founding event will not have an incorrect cache and this may result in a state divergence. Most notably this is used by StationFinder::GetStations.
Steps to reproduce
The text was updated successfully, but these errors were encountered: