From 0644bc29677b6536acbdd775ab8eb1e00a96e537 Mon Sep 17 00:00:00 2001 From: smallmodel <15067410+smallmodel@users.noreply.github.com> Date: Mon, 9 Dec 2024 21:27:08 +0100 Subject: [PATCH] Don't execute old commands from previous map when initializing cgame --- code/client/cl_cgame.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/code/client/cl_cgame.cpp b/code/client/cl_cgame.cpp index 4914e4af..685f32a8 100644 --- a/code/client/cl_cgame.cpp +++ b/code/client/cl_cgame.cpp @@ -944,10 +944,17 @@ void CL_InitCGame( void ) { CL_InitClientSavedData(); } - // init for this gamestate - // use the lastExecutedServerCommand instead of the serverCommandSequence - // otherwise server commands sent just before a gamestate are dropped - cge->CG_Init( &cgi, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum ); + if (cl.snap.valid) { + // init for this gamestate + // use the lastExecutedServerCommand instead of the serverCommandSequence + // otherwise server commands sent just before a gamestate are dropped + cge->CG_Init(&cgi, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum); + } else { + // executing client commands from previous map/server might be an issue, some commands might be cs commands, + // like old CS_SYSTEMINFO configstrings which still contain the sv_serverId from previous map. + // It would cause the client to lose the game state number + cge->CG_Init(&cgi, clc.serverMessageSequence, clc.serverCommandSequence, clc.clientNum); + } ClearNewConfigFlag(); TIKI_FinishLoad();