Use cached g_svDemoPlaying.integer instead of trap_Cvar syscalls

sv_demoplaying is set before devmap, synced during G_RegisterCvars,
and updated every frame by G_UpdateCvars. No need for defensive
trap_Cvar_VariableIntegerValue calls which add unnecessary syscall
overhead on every invocation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
serge_shubin 2026-03-24 04:32:57 +08:00
parent 2ce4aa88f2
commit 5a98ef02cf
2 changed files with 2 additions and 2 deletions

View file

@ -662,7 +662,7 @@ void Cmd_Team_f( gentity_t *ent ) {
char s[MAX_TOKEN_CHARS];
// demo playback: only allow "team spectator" (to exit follow mode)
if ( trap_Cvar_VariableIntegerValue( "sv_demoplaying" ) ) {
if ( g_svDemoPlaying.integer ) {
char s2[MAX_TOKEN_CHARS];
if ( trap_Argc() == 2 ) {
trap_Argv( 1, s2, sizeof(s2) );

View file

@ -419,7 +419,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
G_RegisterCvars();
// signal server-side demo mode to cgame via configstring
if ( trap_Cvar_VariableIntegerValue( "sv_demoplaying" ) ) {
if ( g_svDemoPlaying.integer ) {
trap_SetConfigstring( CS_SVDEMO, "1" );
}