mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-31 11:23:21 +00:00
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'.
This commit is contained in:
parent
0f9dc88834
commit
9f2e23d8ba
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user