From 667119e4af1400096d12a5b5cb43a6368ec9a326 Mon Sep 17 00:00:00 2001 From: Dustinspace217 Date: Sat, 17 Oct 2026 13:16:00 -0700 Subject: [PATCH] Store multiplayer campaign variables when the campaign moves on Since campaign-persistent variables were split from goals and events (only stored when a mission is accepted), the multiplayer paths no longer matched single player: a player-hosted game never stored them, so they reset every mission, and a standalone stored them as soon as the mission ended, so a replayed or retried mission kept its changes. Store variables and containers in multi_campaign_do_debrief when the players continue to a different mission or take a loop, which both kinds of server go through, and have the standalone's postgame store only goals and events, like debrief_init does for a player host. Fixes #4989 --- code/network/multi.cpp | 2 +- code/network/multi_campaign.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/code/network/multi.cpp b/code/network/multi.cpp index d30f7017cce..040cfec5603 100644 --- a/code/network/multi.cpp +++ b/code/network/multi.cpp @@ -1757,7 +1757,7 @@ void multi_standalone_postgame_init() if ( Game_mode & GM_CAMPAIGN_MODE ) { // MUST store goals and events first - may be used to evaluate next mission // store goals and events - mission_campaign_store_goals_and_events_and_variables(false); + mission_campaign_store_goals_and_events(); // evaluate next mission mission_campaign_eval_next_mission(); diff --git a/code/network/multi_campaign.cpp b/code/network/multi_campaign.cpp index 2f89aa7303d..7f8bb0e7813 100644 --- a/code/network/multi_campaign.cpp +++ b/code/network/multi_campaign.cpp @@ -175,6 +175,13 @@ void multi_campaign_do_debrief(int player_status) if((Net_player->flags & NETINFO_FLAG_AM_MASTER) && (Campaign.current_mission != -1) && player_status){ // if players want to go to the next mission if(player_status == 1){ + // as in single player: stored when moving on (a chosen loop counts), not on a replay or retry + if((Campaign.next_mission != Campaign.current_mission) + || (Campaign.loop_enabled && (Campaign.next_mission == Campaign.loop_mission))){ + mission_campaign_store_variables(SEXP_VARIABLE_SAVE_ON_MISSION_PROGRESS, false); + mission_campaign_store_containers(ContainerType::SAVE_ON_MISSION_PROGRESS, false); + } + // move the multiplayer campaign along multi_campaign_next_mission();