From 32afe48aabd61d2f3a781bf9973d0ddeee2c7c32 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 18 Mar 2024 20:22:23 +0000 Subject: [PATCH] M_StartControlPanel: Guarantee titlemap contexts have internal server stopped when entering menu Guarantees netUnlocked is correctly updated in most contexts, since that's dependent on SV_ResetServer, which isn't called if a server is running Also guarantees titlemapinaction isn't true during regular play --- src/d_clisrv.c | 1 + src/k_menufunc.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e28eb8447..cdf4ba8a2 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3927,6 +3927,7 @@ void SV_StopServer(void) maketic = gametic+1; neededtic = maketic; serverrunning = false; + titlemapinaction = false; } // called at singleplayer start and stopdemo diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 4713d74ab..16857216e 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -726,6 +726,14 @@ void M_StartControlPanel(void) { if (gamestate != GS_MENU) { + if (titlemapinaction) + { + // We clear a LITTLE bit of state, but not a full D_ClearState. + // Just enough to guarantee SV_ResetServer is called before session start. + SV_StopServer(); + SV_ResetServer(); + } + G_SetGamestate(GS_MENU); gameaction = ga_nothing;