mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-10 14:52:08 +00:00
FTOS fix: no leading spaces and keeping maximum precision for float values
This commit is contained in:
parent
b62172b915
commit
b34a867ec0
1 changed files with 11 additions and 1 deletions
|
@ -858,12 +858,22 @@ char pr_string_temp[128];
|
|||
void PF_ftos (void)
|
||||
{
|
||||
float v;
|
||||
int i; // 1999-07-25 FTOS fix by Maddes
|
||||
|
||||
v = G_FLOAT(OFS_PARM0);
|
||||
|
||||
if (v == (int)v)
|
||||
sprintf (pr_string_temp, "%d",(int)v);
|
||||
else
|
||||
sprintf (pr_string_temp, "%5.1f",v);
|
||||
// 1999-07-25 FTOS fix by Maddes start
|
||||
{
|
||||
sprintf (pr_string_temp, "%1f", v);
|
||||
for (i=strlen(pr_string_temp)-1 ; i>0 && pr_string_temp[i]=='0' && pr_string_temp[i-1]!='.' ; i--)
|
||||
{
|
||||
pr_string_temp[i] = 0;
|
||||
}
|
||||
}
|
||||
// 1999-07-25 FTOS fix by Maddes end
|
||||
G_INT(OFS_RETURN) = PR_SetString(pr_string_temp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue