From df1a83610c188b2c2151abef588c64cba8770774 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 25 Jul 2024 22:09:24 +0100 Subject: [PATCH] Progsig: Fix multiplayer desync when using copy program --- src/programmable_signals.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/programmable_signals.cpp b/src/programmable_signals.cpp index 9bcfe54afe..7bf3d7f44e 100644 --- a/src/programmable_signals.cpp +++ b/src/programmable_signals.cpp @@ -1061,17 +1061,19 @@ CommandCost CmdSignalProgramMgmt(TileIndex tile, DoCommandFlag flags, uint32_t p if (!IsTileOwner(tile, _current_company)) return_cmd_error(STR_ERROR_AREA_IS_OWNED_BY_ANOTHER); - SignalProgram *prog = GetExistingSignalProgram(SignalReference(tile, track)); - if (!prog) return_cmd_error(STR_ERR_PROGSIG_NOT_THERE); - switch (mgmt) { - case SPMC_REMOVE: + case SPMC_REMOVE: { + SignalProgram *prog = GetExistingSignalProgram(SignalReference(tile, track)); + if (prog == nullptr) return_cmd_error(STR_ERR_PROGSIG_NOT_THERE); if (exec) { prog->first_instruction->Remove(); } break; + } case SPMC_CLONE: { + SignalProgram *prog = GetSignalProgram(SignalReference(tile, track)); + TileIndex src_tile = p2; Track src_track = Extract(p1); if (!IsValidTrack(src_track) || !IsPlainRailTile(src_tile) || !HasTrack(src_tile, src_track)) {