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:
parent
2ce4aa88f2
commit
5a98ef02cf
2 changed files with 2 additions and 2 deletions
|
|
@ -662,7 +662,7 @@ void Cmd_Team_f( gentity_t *ent ) {
|
||||||
char s[MAX_TOKEN_CHARS];
|
char s[MAX_TOKEN_CHARS];
|
||||||
|
|
||||||
// demo playback: only allow "team spectator" (to exit follow mode)
|
// 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];
|
char s2[MAX_TOKEN_CHARS];
|
||||||
if ( trap_Argc() == 2 ) {
|
if ( trap_Argc() == 2 ) {
|
||||||
trap_Argv( 1, s2, sizeof(s2) );
|
trap_Argv( 1, s2, sizeof(s2) );
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
|
||||||
G_RegisterCvars();
|
G_RegisterCvars();
|
||||||
|
|
||||||
// signal server-side demo mode to cgame via configstring
|
// signal server-side demo mode to cgame via configstring
|
||||||
if ( trap_Cvar_VariableIntegerValue( "sv_demoplaying" ) ) {
|
if ( g_svDemoPlaying.integer ) {
|
||||||
trap_SetConfigstring( CS_SVDEMO, "1" );
|
trap_SetConfigstring( CS_SVDEMO, "1" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue