From: Torsten Dreyer Date: Mon, 12 Jan 2015 15:46:24 +0000 (+0100) Subject: Fix wrong ATIS for negative temperatures X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=01dfd52d69225ed6b0252750bbc271431f5a9d61;p=flightgear.git Fix wrong ATIS for negative temperatures --- diff --git a/src/ATC/ATISEncoder.cxx b/src/ATC/ATISEncoder.cxx index 75a397f32..dc41d27ed 100644 --- a/src/ATC/ATISEncoder.cxx +++ b/src/ATC/ATISEncoder.cxx @@ -56,6 +56,12 @@ string ATCSpeech::getSpokenNumber( string number ) string ATCSpeech::getSpokenNumber( int number, bool leadingZero, int digits ) { vector spokenDigits; + bool negative = false; + if( number < 0 ) { + negative = true; + number = -number; + } + int n = 0; while( number > 0 ) { spokenDigits.push_back( getSpokenDigit(number%10) ); @@ -70,8 +76,12 @@ string ATCSpeech::getSpokenNumber( int number, bool leadingZero, int digits ) } string result; + if( negative ) { + result.append( globals->get_locale()->getLocalizedString("minus", "atc", "minus" ) ); + } + while( false == spokenDigits.empty() ) { - if( false == spokenDigits.empty() ) + if( false == result.empty() ) result.SPACE; result.append( spokenDigits.back() );