mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-23 21:34:15 +00:00
engine: cvar: add Cvar_DirectSetValue function
This commit is contained in:
parent
6c3fee7f27
commit
9b6518376c
@ -736,6 +736,24 @@ void Cvar_DirectSet( convar_t *var, const char *value )
|
||||
Cvar_Changed( var );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_DirectSetValue
|
||||
|
||||
functionally is the same as Cvar_SetValue but for direct cvar access
|
||||
============
|
||||
*/
|
||||
void Cvar_DirectSetValue( convar_t *var, float value )
|
||||
{
|
||||
char val[32];
|
||||
|
||||
if( fabs( value - (int)value ) < 0.000001 )
|
||||
Q_snprintf( val, sizeof( val ), "%d", (int)value );
|
||||
else Q_snprintf( val, sizeof( val ), "%f", value );
|
||||
|
||||
Cvar_DirectSet( var, val );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_FullSet
|
||||
|
@ -66,6 +66,7 @@ convar_t *Cvar_Getf( const char *var_name, int flags, const char *description, c
|
||||
void Cvar_LookupVars( int checkbit, void *buffer, void *ptr, setpair_t callback );
|
||||
void Cvar_FullSet( const char *var_name, const char *value, int flags );
|
||||
void Cvar_DirectSet( convar_t *var, const char *value );
|
||||
void Cvar_DirectSetValue( convar_t *var, float value );
|
||||
void Cvar_Set( const char *var_name, const char *value );
|
||||
void Cvar_SetValue( const char *var_name, float value );
|
||||
const char *Cvar_BuildAutoDescription( const char *szName, int flags );
|
||||
|
Loading…
x
Reference in New Issue
Block a user