mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-19 01:52:35 -05:00
puzzles: fix floating-point formatting
This is pretty ad-hoc, but the only other ways are to rewrite sprintf (which would use too much memory on the c200v2), or implement support for floats in rockbox's formatter, neither of which are acceptable. Change-Id: I70d59fd3e90a16e2db9ae0a84cd8c14807f50b46
This commit is contained in:
parent
bf25f3e6e7
commit
c78ff7f615
6 changed files with 23 additions and 7 deletions
|
|
@ -241,7 +241,10 @@ static char *encode_params(const game_params *params, int full)
|
|||
if (params->wrapping)
|
||||
ret[len++] = 'w';
|
||||
if (full && params->barrier_probability)
|
||||
len += sprintf(ret+len, "b%g", params->barrier_probability);
|
||||
{
|
||||
len += sprintf(ret+len, "b");
|
||||
len += ftoa(ret + len, 400, params->barrier_probability);
|
||||
}
|
||||
/* Shuffle limit is part of the limited parameters, because we have to
|
||||
* provide the target move count. */
|
||||
if (params->movetarget)
|
||||
|
|
@ -278,7 +281,7 @@ static config_item *game_configure(const game_params *params)
|
|||
|
||||
ret[3].name = "Barrier probability";
|
||||
ret[3].type = C_STRING;
|
||||
sprintf(buf, "%g", params->barrier_probability);
|
||||
ftoa(buf, 80, params->barrier_probability);
|
||||
ret[3].sval = dupstr(buf);
|
||||
ret[3].ival = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue