This patch addresses the disparity between decimal precision values
for the player stats (Offense, Defense, Bombing, Planet) displayed in
the playerlist window versus those shown in the inform window. The
prior method displayed the stats in the inform window using printf
field width and precision modifiers which sometimes led to rounding
errors. Precision is now maintained to two decimal places. The new
method uses the ftoa() function for COW and the itof22() function for
BRMH to generate values less susceptible to rounding errors.

Here is some test data which shows the problem and how it is corrected:

raw input --> 0.979000, %5.2f output --> 0.98, ftoa output --> 0.97
raw input --> 0.984000, %5.2f output --> 0.98, ftoa output --> 0.98
raw input --> 0.985000, %5.2f output --> 0.98, ftoa output --> 0.98
raw input --> 0.986000, %5.2f output --> 0.99, ftoa output --> 0.98
raw input --> 0.987000, %5.2f output --> 0.99, ftoa output --> 0.98
raw input --> 0.989000, %5.2f output --> 0.99, ftoa output --> 0.98
raw input --> 0.990000, %5.2f output --> 0.99, ftoa output --> 0.99
raw input --> 0.991000, %5.2f output --> 0.99, ftoa output --> 0.99

raw input --> 0.979000, %5.2f output --> 0.98, itof22 output --> 0.97
raw input --> 0.984000, %5.2f output --> 0.98, itof22 output --> 0.98
raw input --> 0.985000, %5.2f output --> 0.98, itof22 output --> 0.98
raw input --> 0.986000, %5.2f output --> 0.99, itof22 output --> 0.98
raw input --> 0.987000, %5.2f output --> 0.99, itof22 output --> 0.98
raw input --> 0.989000, %5.2f output --> 0.99, itof22 output --> 0.98
raw input --> 0.990000, %5.2f output --> 0.99, itof22 output --> 0.98
raw input --> 0.991000, %5.2f output --> 0.99, itof22 output --> 0.99

Quozl: Attached is a patch for COW.

Karth: Attached is a patch for BRMH 2.5.

Bill: I checked and Netrek XP 2009 displays the stats in the inform
window using the same printf method as COW so the COW patch can be
used. You will also need to grab string_util.h and string_util.c to
use the ftoa() function.

Note: the patches can be downloaded from here as well:
http://darcs.jesujuva.org/netrek-client-brmh/patch-brmh2.5.txt
http://darcs.jesujuva.org/netrek-client-cow/patch-cow.txt

I recorded my patches in darcs repos so they may be pulled from here:
http://darcs.jesujuva.org/

Changes may also be viewed online in a more aesthetically pleasing way
here: http://www.jesujuva.org/cgi-bin/darcsweb.cgi

Zach
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch-brmh2.5.txt
Url: http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20080909/b3fd2e16/attachment.txt 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch-cow.txt
Url: http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20080909/b3fd2e16/attachment-0001.txt