From 0c294e0e2e07caaa7d21031b780532e1cd95e2fa Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 30 Oct 2012 16:51:06 +0000 Subject: Fix restoring old fs_game upon leaving a server. Patch by Ensiform. --- src/client/cl_main.c | 11 +++++++---- src/client/cl_parse.c | 6 +++--- src/client/client.h | 7 ++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 189270f1..a7806bba 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -125,6 +125,9 @@ clientConnection_t clc; clientStatic_t cls; vm_t *cgvm; +char cl_oldGame[MAX_QPATH]; +qboolean cl_oldGameSet; + // Structure containing functions exported from refresh DLL refexport_t re; #ifdef USE_RENDERER_DLOPEN @@ -1361,11 +1364,11 @@ static void CL_UpdateGUID( const char *prefix, int prefix_len ) static void CL_OldGame(void) { - if(cls.oldGameSet) + if(cl_oldGameSet) { // change back to previous fs_game - cls.oldGameSet = qfalse; - Cvar_Set2("fs_game", cls.oldGame, qtrue); + cl_oldGameSet = qfalse; + Cvar_Set2("fs_game", cl_oldGame, qtrue); FS_ConditionalRestart(clc.checksumFeed, qfalse); } } @@ -3506,7 +3509,7 @@ void CL_Init( void ) { { CL_ClearState(); clc.state = CA_DISCONNECTED; // no longer CA_UNINITIALIZED - cls.oldGameSet = qfalse; + cl_oldGameSet = qfalse; } cls.realtime = 0; diff --git a/src/client/cl_parse.c b/src/client/cl_parse.c index 38d9edd3..c72a5588 100644 --- a/src/client/cl_parse.c +++ b/src/client/cl_parse.c @@ -529,10 +529,10 @@ void CL_ParseGamestate( msg_t *msg ) { CL_StopRecord_f(); // reinitialize the filesystem if the game directory has changed - if(!cls.oldGameSet && (Cvar_Flags("fs_game") & CVAR_MODIFIED)) + if(!cl_oldGameSet && (Cvar_Flags("fs_game") & CVAR_MODIFIED)) { - cls.oldGameSet = qtrue; - Q_strncpyz(cls.oldGame, oldGame, sizeof(cls.oldGame)); + cl_oldGameSet = qtrue; + Q_strncpyz(cl_oldGame, oldGame, sizeof(cl_oldGame)); } FS_ConditionalRestart(clc.checksumFeed, qfalse); diff --git a/src/client/client.h b/src/client/client.h index 37e36a91..bd50fbb6 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -279,6 +279,7 @@ extern clientConnection_t clc; the clientStatic_t structure is never wiped, and is used even when no client connection is active at all +(except when CL_Shutdown is called) ================================================================== */ @@ -340,9 +341,6 @@ typedef struct { serverInfo_t favoriteServers[MAX_OTHER_SERVERS]; int pingUpdateSource; // source currently pinging or updating - - char oldGame[MAX_QPATH]; - qboolean oldGameSet; // update server info netadr_t updateServer; @@ -360,6 +358,9 @@ typedef struct { extern clientStatic_t cls; +extern char cl_oldGame[MAX_QPATH]; +extern qboolean cl_oldGameSet; + //============================================================================= extern vm_t *cgvm; // interface to cgame dll or vm -- cgit