From: curt Date: Thu, 10 Sep 2009 18:12:33 +0000 (+0000) Subject: Handle "double" type fields correctly for ascii input data. Previously double X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bf423ef0cae72c5690bac6ae2224e5fb741daff3;p=flightgear.git Handle "double" type fields correctly for ascii input data. Previously double data was being down-cast to float and the loss of precision impacted data types like lon/lat positions dramatically, preventing smooth replay of data. --- diff --git a/src/Network/generic.cxx b/src/Network/generic.cxx index b1e0c2048..f952c1e66 100644 --- a/src/Network/generic.cxx +++ b/src/Network/generic.cxx @@ -378,9 +378,13 @@ bool FGGeneric::parse_message_ascii() { case FG_FIXED: case FG_FLOAT: + val = _in_message[i].offset + strtof(p1, 0) * _in_message[i].factor; + _in_message[i].prop->setFloatValue((float)val); + break; + case FG_DOUBLE: val = _in_message[i].offset + strtod(p1, 0) * _in_message[i].factor; - _in_message[i].prop->setFloatValue((float)val); + _in_message[i].prop->setDoubleValue(val); break; default: // SG_STRING