format float CVars without trailing zeroes

This commit is contained in:
myT 2023-10-30 21:46:55 +01:00
parent 609e11f11d
commit 1dca257c9d
2 changed files with 3 additions and 3 deletions

View file

@ -2,7 +2,7 @@
See the end of this file for known issues. See the end of this file for known issues.
29 Sep 23 - 1.53 30 Oct 23 - 1.53
add: /registerdemos adds Windows file associations for demo files (.dm_68 .dm_67 .dm_66) add: /registerdemos adds Windows file associations for demo files (.dm_68 .dm_67 .dm_66)
/unregisterdemos removes Windows file associations for demo files /unregisterdemos removes Windows file associations for demo files

View file

@ -794,7 +794,7 @@ void Cvar_SetValue( const char *var_name, float value )
if ( value == (int)value ) { if ( value == (int)value ) {
Cvar_Set( var_name, va("%i", (int)value) ); Cvar_Set( var_name, va("%i", (int)value) );
} else { } else {
Cvar_Set( var_name, va("%f", value) ); Cvar_Set( var_name, va("%g", value) );
} }
} }
@ -1037,7 +1037,7 @@ static void Cvar_ExecuteOp( qbool multiply )
const float fValU = multiply ? ( cvar->value * fTemp ) : ( cvar->value + fTemp ); const float fValU = multiply ? ( cvar->value * fTemp ) : ( cvar->value + fTemp );
const float fValC = Com_Clamp( cvar->validator.f.min, cvar->validator.f.max, fValU ); const float fValC = Com_Clamp( cvar->validator.f.min, cvar->validator.f.max, fValU );
Cvar_Set( Cmd_Argv(1), va("%f", fValC) ); Cvar_Set( Cmd_Argv(1), va("%g", fValC) );
} }
} }