(svn r9110) [gamebalance] -Add: Added a double-cast operator for FixedT data type for C-compatible output with fprintf.
--- a/src/fixedt.h Thu Mar 08 09:41:06 2007 +0000
+++ b/src/fixedt.h Sun Mar 11 10:21:12 2007 +0000
@@ -174,6 +174,14 @@
FixedT(int numerator, int denominator) {Raw::m_data = ((int64)numerator << Raw::dec_bits) / (int64)denominator;}
/**
+ * Cast to a double (for outputs)
+ */
+ operator double() const
+ {
+ return (double)Raw::m_data / (1 << Raw::dec_bits);
+ }
+
+ /**
* Equality operator
* @param comparator The non-floating point variable we want to compare against
*/