freebsd-ports/games/7kaa/files/patch-src_common_OMISC.cpp
Dmitry Marakasov 1fe3c71e87 This is a GPL release of the Seven Kingdoms: Ancient Adversaries
thanks to Enlight Software which granted the ability to license the
game under a free and open source license in 2009. See the file
"COPYING" for the details of the license. We are indebted to Enlight
for making the 7kfans project possible and giving a new chance to
build a community for fans of the game.

WWW: http://7kfans.com/
2015-05-21 12:56:58 +00:00

25 lines
736 B
C++

--- src/common/OMISC.cpp.orig 2015-05-19 01:00:20 UTC
+++ src/common/OMISC.cpp
@@ -37,6 +37,7 @@
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
+#include <math.h>
#include <ALL.h>
#include <OSTR.h>
@@ -755,10 +756,13 @@ char* Misc::format(double inNum, int for
static char outBuf[35];
char *outPtr=outBuf;
+ char floatBuf[35];
char *floatStr;
int i, intDigit, sign; // intDigit = no. of integer digits
- floatStr = fcvt( inNum, MONEY_DEC_PLACE, &intDigit, &sign );
+ intDigit = snprintf(floatBuf, sizeof(floatBuf), "%.0lf", fabs(inNum) * 100.0);
+ intDigit -= 2;
+ floatStr = floatBuf;
#ifdef DEBUG
if( intDigit > 29 ) // integer digits can't exceed 29