From 667dc8a02a5df94a27f57f30ee09a1817e13ae83 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R <legoboyvdlp@gmail.com> Date: Sat, 12 Jun 2021 13:23:19 +0100 Subject: [PATCH] audioindex.cxx: readability improvements: remove Yoda condition and use NOT operator rather than == false --- src/Sound/audioident.cxx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Sound/audioident.cxx b/src/Sound/audioident.cxx index bb924c26b..530075f45 100644 --- a/src/Sound/audioident.cxx +++ b/src/Sound/audioident.cxx @@ -27,11 +27,11 @@ #include <Sound/morse.hxx> AudioIdent::AudioIdent( const std::string & fx_name, const double interval_secs, const int frequency_hz ) : - _fx_name(fx_name), - _frequency(frequency_hz), - _timer(0.0), - _interval(interval_secs), - _running(false) + _fx_name(fx_name), + _frequency(frequency_hz), + _timer(0.0), + _interval(interval_secs), + _running(false) { } @@ -88,11 +88,11 @@ void AudioIdent::setIdent( const std::string & ident, double volumeNorm ) if (ident.empty()) volumeNorm = 0; - if(( _ident == ident )|| - (volumeNorm == 0)) // don't bother with sounds when volume is OFF anyway... + // don't bother with sounds when volume is OFF anyway... + if ((_ident == ident ) || (volumeNorm == 0)) { - if( false == _ident.empty() ) - setVolumeNorm( volumeNorm ); + if (!_ident.empty()) + setVolumeNorm(volumeNorm); return; } @@ -102,8 +102,7 @@ void AudioIdent::setIdent( const std::string & ident, double volumeNorm ) if ( _sgr->exists( _fx_name ) ) _sgr->remove( _fx_name ); - if( false == ident.empty() ) { - + if (!ident.empty()) { SGSoundSample* sound = FGMorse::instance()->make_ident(ident, _frequency ); sound->set_volume( volumeNorm ); if (!_sgr->add( sound, _fx_name )) { @@ -125,7 +124,7 @@ void AudioIdent::setIdent( const std::string & ident, double volumeNorm ) void AudioIdent::update( double dt ) { // single-shot - if( false == _running || _interval < SGLimitsd::min() ) + if( !_running || _interval < SGLimitsd::min() ) return; _timer -= dt;