use %g instead of %f and the 0s hack

This commit is contained in:
Bill Currie 2003-03-03 17:52:11 +00:00
parent 389542fda7
commit beecb5580f

View file

@ -282,18 +282,12 @@ Cvar_SetROM (cvar_t *var, const char *value)
var->callback (var); var->callback (var);
} }
// 1999-09-07 weird cvar zeros fix by Maddes
void void
Cvar_SetValue (cvar_t *var, float value) Cvar_SetValue (cvar_t *var, float value)
{ {
char val[32]; char val[32];
int i;
snprintf (val, sizeof (val), "%f", value); snprintf (val, sizeof (val), "%g", value);
for (i = strlen (val) - 1; i > 0 && val[i] == '0' && val[i - 1] != '.';
i--) {
val[i] = 0;
}
Cvar_Set (var, val); Cvar_Set (var, val);
} }