summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2011-10-22 00:25:26 +0000
committerSimon Howard2011-10-22 00:25:26 +0000
commitdaa2dde19e2b1d27477eaa618157551d3fcd84bb (patch)
treedd27e37ed91b3aef0883132acc0471301f9c7d9d
parent1b4ad12272d7250ed8d62d82fca5ca96161bb481 (diff)
downloadchocolate-doom-daa2dde19e2b1d27477eaa618157551d3fcd84bb.tar.gz
chocolate-doom-daa2dde19e2b1d27477eaa618157551d3fcd84bb.tar.bz2
chocolate-doom-daa2dde19e2b1d27477eaa618157551d3fcd84bb.zip
Fix percentage output to match that of statdump.exe.
Subversion-branch: /branches/v2-branch Subversion-revision: 2452
-rw-r--r--src/doom/statdump.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/doom/statdump.c b/src/doom/statdump.c
index 0e83df8d..e80641c8 100644
--- a/src/doom/statdump.c
+++ b/src/doom/statdump.c
@@ -152,7 +152,12 @@ static void PrintPercentage(FILE *stream, int amount, int total)
{
fprintf(stream, "%i / %i", amount, total);
- fprintf(stream, " (%i%%)", (amount * 100) / total);
+ // statdump.exe is a 16-bit program, so very occasionally an
+ // integer overflow can occur when doing this calculation with
+ // a large value. Therefore, cast to short to give the same
+ // output.
+
+ fprintf(stream, " (%i%%)", (short) (amount * 100) / total);
}
}