diff options
author | frosch <frosch@openttd.org> | 2020-05-03 22:06:56 +0200 |
---|---|---|
committer | frosch <github@elsenhans.name> | 2020-05-03 23:18:30 +0200 |
commit | 9f2e23d8bac33effe68c911335e8a1d6ff6211fb (patch) | |
tree | c47cca708e5139f40475086e4f7f17ba12a22779 | |
parent | 0f9dc88834fd6b44a62b1f3395e71653008f69e9 (diff) | |
download | openttd-9f2e23d8bac33effe68c911335e8a1d6ff6211fb.tar.xz |
Fix #8093: Build+Refit changed game-state in command test run, and thus caused desyncs.
Use DC_AUTOREPLACE for actions that shall be reversibe, in this case:
- Do not rearrange free wagons in test-run.
- Do not discard OrderBackups.
The latter was not triggered by actual auto-replace, since it does not set a 'user'.
-rw-r--r-- | src/vehicle_cmd.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index 7383e1d4a..2f0a49ca2 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -128,7 +128,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint /* If we are refitting we need to temporarily purchase the vehicle to be able to * test it. */ DoCommandFlag subflags = flags; - if (refitting) subflags |= DC_EXEC; + if (refitting && !(flags & DC_EXEC)) subflags |= DC_EXEC | DC_AUTOREPLACE; /* Vehicle construction needs random bits, so we have to save the random * seeds to prevent desyncs. */ @@ -173,7 +173,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint if (v->IsPrimaryVehicle()) { GroupStatistics::CountVehicle(v, 1); - OrderBackup::Restore(v, p2); + if (!(subflags & DC_AUTOREPLACE)) OrderBackup::Restore(v, p2); } } |