From f825bb4f3cf693773ce1928799e4b0c289e1b02d Mon Sep 17 00:00:00 2001 From: Richard Senior Date: Tue, 26 Apr 2016 10:08:42 +0100 Subject: [PATCH] Eliminate use of non-standard round() function in ATISEncoder Use of round() produces compilation errors with MSVC10 and the build server --- src/ATC/ATISEncoder.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ATC/ATISEncoder.cxx b/src/ATC/ATISEncoder.cxx index f24e4469a..03f48e282 100644 --- a/src/ATC/ATISEncoder.cxx +++ b/src/ATC/ATISEncoder.cxx @@ -507,12 +507,12 @@ string ATISEncoder::getVisibilityMiles( SGPropertyNode_ptr ) string feet = globals->get_locale()->getLocalizedString("feet", "atc", "feet" ); int v = _atis->getVisibilityMeters(); - int vft = round( v * SG_METER_TO_FEET / 100 ) * 100; // Rounded to 100 feet - int vsm = round( v * SG_METER_TO_SM ); + int vft = int( v * SG_METER_TO_FEET / 100 + 0.5 ) * 100; // Rounded to 100 ft + int vsm = int( v * SG_METER_TO_SM + 0.5 ); string reply; if( vsm < 1 ) return reply.append( getSpokenAltitude( vft ) ).SPACE.append( feet ); - if( v >= 9999 ) return reply.append( getSpokenNumber(10) ); + if( vsm >= 10 ) return reply.append( getSpokenNumber(10) ); return reply.append( getSpokenNumber( vsm ) ); } @@ -572,7 +572,7 @@ string ATISEncoder::getInhgInteger( SGPropertyNode_ptr ) string ATISEncoder::getInhgFraction( SGPropertyNode_ptr ) { double qnh = _atis->getQnh() * 100 / SG_INHG_TO_PA; - int f = round(100 * (qnh - (int)qnh)); + int f = int(100 * (qnh - int(qnh)) + 0.5); return getSpokenNumber( f, true, 2 ); } -- 2.39.2