From 692afe0bcbf9b3d0e584e12394f3cd0050fcc2b0 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 30 Oct 2008 20:42:21 +0000 Subject: [PATCH] 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. --- src/Instrumentation/marker_beacon.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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; -- 2.39.5