* (bug 3018) need to call Cvar_SetCheatState() after CG_INIT and UI_INIT to

override user-defined cvar values for CVAR_CHEAT cvars that
             could be registered in cgame and ui.
This commit is contained in:
Tony J. White = 2007-03-02 17:32:22 +00:00
parent ddc848dced
commit 2218a4ea67
4 changed files with 12 additions and 1 deletions

View file

@ -746,6 +746,10 @@ void CL_InitCGame( void ) {
// otherwise server commands sent just before a gamestate are dropped // otherwise server commands sent just before a gamestate are dropped
VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum ); VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum );
// reset any CVAR_CHEAT cvars registered by cgame
if ( !cl_connectedToCheatServer )
Cvar_SetCheatState();
// we will send a usercmd this frame, which // we will send a usercmd this frame, which
// will cause the server to send us the first snapshot // will cause the server to send us the first snapshot
cls.state = CA_PRIMED; cls.state = CA_PRIMED;

View file

@ -325,6 +325,7 @@ void CL_ParseSnapshot( msg_t *msg ) {
//===================================================================== //=====================================================================
int cl_connectedToPureServer; int cl_connectedToPureServer;
int cl_connectedToCheatServer;
/* /*
================== ==================
@ -355,7 +356,8 @@ void CL_SystemInfoChanged( void ) {
} }
s = Info_ValueForKey( systemInfo, "sv_cheats" ); s = Info_ValueForKey( systemInfo, "sv_cheats" );
if ( atoi(s) == 0 ) { cl_connectedToCheatServer = atoi( s );
if ( !cl_connectedToCheatServer ) {
Cvar_SetCheatState(); Cvar_SetCheatState();
} }

View file

@ -1171,6 +1171,10 @@ void CL_InitUI( void ) {
// init for this gamestate // init for this gamestate
VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE) ); VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE) );
} }
// reset any CVAR_CHEAT cvars registered by ui
if ( !cl_connectedToCheatServer )
Cvar_SetCheatState();
} }
qboolean UI_usesUniqueCDKey( void ) { qboolean UI_usesUniqueCDKey( void ) {

View file

@ -442,6 +442,7 @@ char *Key_KeynumToString (int keynum);
// cl_parse.c // cl_parse.c
// //
extern int cl_connectedToPureServer; extern int cl_connectedToPureServer;
extern int cl_connectedToCheatServer;
void CL_SystemInfoChanged( void ); void CL_SystemInfoChanged( void );
void CL_ParseServerMessage( msg_t *msg ); void CL_ParseServerMessage( msg_t *msg );