]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/marker_beacon.cxx
Yank out all the glut dependencies and concentrate them in a (easily
[flightgear.git] / src / Cockpit / marker_beacon.cxx
index 1a0d6f327c4e9882bb59fe6ab1332ea1928ee98e..88e3e03708ca964299039485c412dbbe3a4baa4b 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <Aircraft/aircraft.hxx>
 #include <Navaids/mkrbeacons.hxx>
-#include <Time/FGEventMgr.hxx>
 
 #include "marker_beacon.hxx"
 
 SG_USING_STD(string);
 
 
-/**
- * Boy, this is ugly!  Make the VOR range vary by altitude difference.
- */
-static double kludgeRange ( double stationElev, double aircraftElev,
-                           double nominalRange)
-{
-                               // Assume that the nominal range (usually
-                               // 50nm) applies at a 5,000 ft difference.
-                               // Just a wild guess!
-  double factor = ((aircraftElev*SG_METER_TO_FEET) - stationElev) / 5000.0;
-  double range = fabs(nominalRange * factor);
-
-                               // Clamp the range to keep it sane; for
-                               // now, never less than 25% or more than
-                               // 500% of nominal range.
-  if (range < nominalRange/4.0) {
-    range = nominalRange/4.0;
-  } else if (range > nominalRange*5.0) {
-    range = nominalRange*5.0;
-  }
-
-  return range;
-}
-
-
 // Constructor
 FGMarkerBeacon::FGMarkerBeacon() :
     lon_node(fgGetNode("/position/longitude-deg", true)),
@@ -73,7 +47,7 @@ FGMarkerBeacon::FGMarkerBeacon() :
     bus_power(fgGetNode("/systems/electrical/outputs/navcom[0]", true)),
     power_btn(fgGetNode("/radios/marker-beacon/power-btn", true)),
     audio_btn(fgGetNode("/radios/marker-beacon/audio-btn", true)),
-    servicable(fgGetNode("/instrumentation/marker-beacons/servicable", true)),
+    serviceable(fgGetNode("/instrumentation/marker-beacons/serviceable", true)),
                  
     need_update(true),
     outer_blink(false),
@@ -94,7 +68,7 @@ FGMarkerBeacon::FGMarkerBeacon() :
 
     power_btn->setBoolValue( true );
     audio_btn->setBoolValue( true );
-    servicable->setBoolValue( true );
+    serviceable->setBoolValue( true );
 }
 
 
@@ -146,7 +120,7 @@ FGMarkerBeacon::update(double dt)
 {
     need_update = false;
 
-    if ( has_power() && servicable->getBoolValue() ) {
+    if ( has_power() && serviceable->getBoolValue() ) {
         // marker beacon blinking
         bool light_on = ( outer_blink || middle_blink || inner_blink );
         SGTimeStamp current;
@@ -206,7 +180,7 @@ void FGMarkerBeacon::search()
     outer_marker = middle_marker = inner_marker = false;
 
     if ( beacon_type == FGMkrBeacon::NOBEACON
-         || !has_power() || !servicable->getBoolValue() )
+         || !has_power() || !serviceable->getBoolValue() )
     {
        // cout << "no marker" << endl;
         beacon_type = FGMkrBeacon::NOBEACON;
@@ -218,15 +192,15 @@ void FGMarkerBeacon::search()
        // cout << "OUTER MARKER" << endl;
         if ( last_beacon != FGMkrBeacon::OUTER ) {
             if ( ! globals->get_soundmgr()->exists( "outer-marker" ) ) {
-                FGSimpleSound *sound = beacon.get_outer();
+                SGSimpleSound *sound = beacon.get_outer();
                 sound->set_volume( 0.3 );
                 globals->get_soundmgr()->add( sound, "outer-marker" );
             }
         }
-        if ( audio_btn->getBoolValue() 
-             && !globals->get_soundmgr()->is_playing("outer-marker") )
-        {
-            globals->get_soundmgr()->play_looped( "outer-marker" );
+        if ( audio_btn->getBoolValue() ) {
+            if ( !globals->get_soundmgr()->is_playing("outer-marker") ) {
+                globals->get_soundmgr()->play_looped( "outer-marker" );
+            }
         } else {
             globals->get_soundmgr()->stop( "outer-marker" );
         }
@@ -235,15 +209,15 @@ void FGMarkerBeacon::search()
        // cout << "MIDDLE MARKER" << endl;
        if ( last_beacon != FGMkrBeacon::MIDDLE ) {
            if ( ! globals->get_soundmgr()->exists( "middle-marker" ) ) {
-               FGSimpleSound *sound = beacon.get_middle();
+               SGSimpleSound *sound = beacon.get_middle();
                sound->set_volume( 0.3 );
                globals->get_soundmgr()->add( sound, "middle-marker" );
            }
         }
-        if ( audio_btn->getBoolValue() 
-             && !globals->get_soundmgr()->is_playing("middle-marker") )
-        {
-            globals->get_soundmgr()->play_looped( "middle-marker" );
+        if ( audio_btn->getBoolValue() ) {
+            if ( !globals->get_soundmgr()->is_playing("middle-marker") ) {
+                globals->get_soundmgr()->play_looped( "middle-marker" );
+            }
         } else {
             globals->get_soundmgr()->stop( "middle-marker" );
         }
@@ -252,15 +226,15 @@ void FGMarkerBeacon::search()
        // cout << "INNER MARKER" << endl;
        if ( last_beacon != FGMkrBeacon::INNER ) {
            if ( ! globals->get_soundmgr()->exists( "inner-marker" ) ) {
-               FGSimpleSound *sound = beacon.get_inner();
+               SGSimpleSound *sound = beacon.get_inner();
                sound->set_volume( 0.3 );
                globals->get_soundmgr()->add( sound, "inner-marker" );
            }
         }
-        if ( audio_btn->getBoolValue() 
-             && !globals->get_soundmgr()->is_playing("inner-marker") )
-        {
-            globals->get_soundmgr()->play_looped( "inner-marker" );
+        if ( audio_btn->getBoolValue() ) {
+            if ( !globals->get_soundmgr()->is_playing("inner-marker") ) {
+                globals->get_soundmgr()->play_looped( "inner-marker" );
+            }
         } else {
             globals->get_soundmgr()->stop( "inner-marker" );
         }