From: curt Date: Thu, 30 Oct 2008 20:42:21 +0000 (+0000) Subject: Fix a bug where the search() function was not being called if power was false X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=692afe0bcbf9b3d0e584e12394f3cd0050fcc2b0;p=flightgear.git Fix a bug where the search() function was not being called if power was false or the unit was not serviceable. This search() routine needs to run every iteration no matter what the power or serviceable state. If power is turned off or the unit becomes unserviceable while a beacon sound is playing, the search() routine still needs to be called so the sound effect can be properly disabled. --- diff --git a/src/Instrumentation/marker_beacon.cxx b/src/Instrumentation/marker_beacon.cxx index 9d8022efe..822ef4e3d 100644 --- a/src/Instrumentation/marker_beacon.cxx +++ b/src/Instrumentation/marker_beacon.cxx @@ -156,14 +156,20 @@ FGMarkerBeacon::update(double dt) { need_update = false; + // On timeout, scan again, this needs to run every iteration no + // matter what the power or serviceable state. If power is turned + // off or the unit becomes unserviceable while a beacon sound is + // playing, the search() routine still needs to be called so the + // sound effect can be properly disabled. + + _time_before_search_sec -= dt; + if ( _time_before_search_sec < 0 ) { + search(); + } + if ( has_power() && serviceable->getBoolValue() && !sound_pause->getBoolValue()) { - // On timeout, scan again - _time_before_search_sec -= dt; - if ( _time_before_search_sec < 0 ) { - search(); - } // marker beacon blinking bool light_on = ( outer_blink || middle_blink || inner_blink ); SGTimeStamp current;