Browse Source

engine: common: cvar: do not check if cvar was registered in DirectSet when it has valid next pointer

pull/2/head
Alibek Omarov 2 years ago
parent
commit
cb43df43ef
  1. 12
      engine/common/cvar.c

12
engine/common/cvar.c

@ -681,18 +681,18 @@ void Cvar_DirectSet( convar_t *var, const char *value )
{ {
const char *pszValue; const char *pszValue;
if( !var ) return; // ??? if( unlikely( !var )) return; // ???
// lookup for registration // lookup for registration
if( CVAR_CHECK_SENTINEL( var ) || ( var->next == NULL && !FBitSet( var->flags, FCVAR_EXTENDED|FCVAR_ALLOCATED ))) if( unlikely( CVAR_CHECK_SENTINEL( var ) || ( var->next == NULL && !FBitSet( var->flags, FCVAR_EXTENDED|FCVAR_ALLOCATED ))))
{ {
// need to registering cvar fisrt // need to registering cvar fisrt
Cvar_RegisterVariable( var ); // ok, register it Cvar_RegisterVariable( var ); // ok, register it
}
// lookup for registration again // lookup for registration again
if( var != Cvar_FindVar( var->name )) if( var != Cvar_FindVar( var->name ))
return; // how this possible? return; // how this possible?
}
if( FBitSet( var->flags, FCVAR_READ_ONLY )) if( FBitSet( var->flags, FCVAR_READ_ONLY ))
{ {

Loading…
Cancel
Save