Skip to content
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

Build and refit feature is not MP-safe, causes immediate desyncs #7469

Closed
JGRennison opened this issue Apr 4, 2019 · 0 comments
Closed

Build and refit feature is not MP-safe, causes immediate desyncs #7469

JGRennison opened this issue Apr 4, 2019 · 0 comments

Comments

@JGRennison
Copy link
Contributor

@JGRennison JGRennison commented Apr 4, 2019

Version of OpenTTD

Since d54b6ac

Expected result

Desync does not occur

Actual result

Desync occurs shortly after vehicle details are shown in the purchasing GUI when a refit would occur on purchase.
It is not necessary to actually click the "Buy and refit" button for the desync to occur, however doing so would also trigger the desync.

The current implementation of CmdBuildVehicle when in test mode (i.e. without DC_EXEC), purchases the vehicle with DC_EXEC and immediately sells it again with DC_EXEC.
This is not MP-safe as vehicle purchase and sale are not side-effect free operations.
In particular VehicleRandomBits() is called which will update the random seed, triggering the desync immediately.
NewGRFs callbacks involved in purchasing may also be potentially problematic.

Steps to reproduce

Use of the "build and refit" feature in a multiplayer game.

PeterN added a commit to PeterN/OpenTTD that referenced this issue Apr 4, 2019
PeterN added a commit to PeterN/OpenTTD that referenced this issue Apr 4, 2019
@PeterN PeterN closed this in 8114bad Apr 4, 2019
douiwby added a commit to douiwby/OpenTTD that referenced this issue Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant