# HG changeset patch # User Adam Kaminski # Date 1605447208 18000 # Sun Nov 15 08:33:28 2020 -0500 # Node ID f6f0c8b7c8f14de6d863b2592e71a9e165edd0d1 # Parent 1b967b0845d22e1274db2d96d2010ad368e388a2 Fixed mask-type CVars that were a part of the serverinfo from being unchangeable in online games, which were also printing strange warning messages when the client gained RCON access. diff -r 1b967b0845d2 -r f6f0c8b7c8f1 src/c_cvars.cpp --- a/src/c_cvars.cpp Sun Nov 15 08:28:46 2020 -0500 +++ b/src/c_cvars.cpp Sun Nov 15 08:33:28 2020 -0500 @@ -1291,11 +1291,12 @@ // exec scripts because all flags will base their changes off of the value of // the "master" cvar at the time the script was run, overriding any changes // another flag might have made to the same cvar earlier in the script. - if ((ValueVar.GetFlags() & CVAR_SERVERINFO) && gamestate != GS_STARTUP && !demoplayback) + if (( NETWORK_GetState() != NETSTATE_SERVER ) && ( ValueVar.GetFlags() & CVAR_SERVERINFO ) && gamestate != GS_STARTUP && !demoplayback ) { // [BB] netgame && !players[consoleplayer].settings_controller -> NETWORK_InClientMode( ) // [TP] Let RCON clients set this CVar. - if ( NETWORK_InClientMode() && ( CLIENT_HasRCONAccess() == false ) ) + // [AK] RCON clients that still need to reset any server setting CVars should be allowed to set this CVar. + if ( NETWORK_InClientMode() && ( CLIENT_HasRCONAccess() == false ) && ( CLIENT_GainingRCONAccess() == false ) ) { Printf ("Only setting controllers can change %s\n", Name); return; diff -r 1b967b0845d2 -r f6f0c8b7c8f1 src/cl_main.cpp --- a/src/cl_main.cpp Sun Nov 15 08:28:46 2020 -0500 +++ b/src/cl_main.cpp Sun Nov 15 08:33:28 2020 -0500 @@ -377,6 +377,9 @@ // [TP] Do we have RCON access to the server? static bool g_HasRCONAccess = false; +// [AK] We are in the process of gaining RCON access to the server. +static bool g_GainingRCONAccess = false; + //***************************************************************************** // FUNCTIONS @@ -2204,8 +2207,10 @@ case SVC2_RCONACCESS: if ( pByteStream->ReadByte() ) { - if ( CLIENT_HasRCONAccess() == false ) + if ( CLIENT_HasRCONAccess() == false && CLIENT_GainingRCONAccess() == false ) { + g_GainingRCONAccess = true; + // The server will send all server setting CVars that are not at default value. So, to ensure // the rest are correct, we reset them now. // NOTE: This is done before g_HasRCONAccess is set or the client would instead tell the server @@ -2215,6 +2220,8 @@ if ( cvar->IsServerCVar() ) cvar->ResetToDefault(); } + + g_GainingRCONAccess = false; } g_HasRCONAccess = true; @@ -2344,6 +2351,9 @@ g_lMissingPacketTicks = 0; + // [AK] Since we disconnected, we don't have RCON access anymore. + g_HasRCONAccess = false; + // Set the network state back to single player. NETWORK_SetState( NETSTATE_SINGLE ); @@ -2683,6 +2693,12 @@ } //***************************************************************************** +bool CLIENT_GainingRCONAccess() +{ + return g_GainingRCONAccess; +} + +//***************************************************************************** // // :(. This is needed so that the MOTD can be printed in the color the user wishes to print // mid-screen messages in. diff -r 1b967b0845d2 -r f6f0c8b7c8f1 src/cl_main.h --- a/src/cl_main.h Sun Nov 15 08:28:46 2020 -0500 +++ b/src/cl_main.h Sun Nov 15 08:33:28 2020 -0500 @@ -188,6 +188,7 @@ const char *commandName = "CLIENT_ReadActorFromNetID", const char *parameterName = "actor" ); bool CLIENT_HasRCONAccess(); +bool CLIENT_GainingRCONAccess(); void CLIENT_PREDICT_Construct( void ); void CLIENT_PREDICT_SetPosition( fixed_t X, fixed_t Y, fixed_t Z ); void CLIENT_PREDICT_SetVelocity( fixed_t X, fixed_t Y, fixed_t Z );