mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
use %g instead of %f and the 0s hack
This commit is contained in:
parent
389542fda7
commit
beecb5580f
1 changed files with 1 additions and 7 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue