]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/approach.cxx
A bunch of reorg and clean up of the KR 87 (adf) code including some
[flightgear.git] / src / ATC / approach.cxx
index 5c2e6431f555a9844616c8df33e8c4a5e286ecd0..c3b2390fc125604d423d860b8a73a9522215c094 100644 (file)
 
 #include <simgear/misc/sg_path.hxx>
 
-#ifdef FG_NEW_ENVIRONMENT
-#include <Environment/environment_mgr.hxx>
-#include <Environment/environment.hxx>
+#ifdef FG_WEATHERCM
+# include <WeatherCM/FGLocalWeatherDatabase.h>
 #else
-#include <WeatherCM/FGLocalWeatherDatabase.h>
+# include <Environment/environment_mgr.hxx>
+# include <Environment/environment.hxx>
 #endif
 
+
+PlaneApp::PlaneApp()
+:
+  ident(""),
+  lon(0.0),
+  lat(0.0),
+  alt(0.0),
+  hdg(0.0),
+  dist(0.0),
+  brg(0.0),
+  spd(0.0),
+  contact(0),
+  wpn(0),
+  dnwp(-999.),
+  dcc(0.0),
+  dnc(0.0),
+  aalt(0.0),
+  ahdg(0.0),
+  on_crs(true),
+  tlm(0.0)
+{
+}
+
 //Constructor
-FGApproach::FGApproach(){
+FGApproach::FGApproach()
+: type(0),
+  lon(0.0), lat(0.0), elev(0.0),
+  x(0.0), y(0.0), z(0.0),
+  freq(0),
+  bucket(0),
+  range(0.0),
+  active_runway(""),
+  active_rw_hdg(0.0),
+  display(false),
+  displaying(false),
+  ident(""),
+  name(""),
+  num_planes(0),
+  transmission(""),
+  first(true),
+  trans_ident(""),
+  approach_failed(false)
+{
   comm1_node = fgGetNode("/radios/comm[0]/frequencies/selected-mhz", true);
   comm2_node = fgGetNode("/radios/comm[1]/frequencies/selected-mhz", true);
 
-  num_planes = 0;
   lon_node = fgGetNode("/position/longitude-deg", true);
   lat_node = fgGetNode("/position/latitude-deg", true);
   elev_node = fgGetNode("/position/altitude-ft", true);
-  first = true;
-  active_runway = "";
-  for ( int i=0; i<max_planes; i++) {
-    planes[i].contact = 0;
-    planes[i].wpn     = 0;
-    planes[i].dnwp    = -999.;
-    planes[i].on_crs  = true;
-  }
 }
 
 //Destructor
@@ -189,12 +221,12 @@ void FGApproach::Update() {
 // ============================================================================
 void FGApproach::get_active_runway() {
 
-#ifdef FG_NEW_ENVIRONMENT
-  FGEnvironment stationweather =
-    globals->get_environment_mgr()->getEnvironment(lat, lon, elev);
-#else
+#ifdef FG_WEATHERCM
   sgVec3 position = { lat, lon, elev };
   FGPhysicalProperty stationweather = WeatherDatabase->get(position);
+#else
+  FGEnvironment stationweather =
+    globals->get_environment_mgr()->getEnvironment(lat, lon, elev);
 #endif
 
   SGPath path( globals->get_fg_root() );
@@ -203,9 +235,7 @@ void FGApproach::get_active_runway() {
   FGRunways runways( path.c_str() );
   
   //Set the heading to into the wind
-#ifdef FG_NEW_ENVIRONMENT
-  double hdg = stationweather.get_wind_from_heading_deg();
-#else
+#ifdef FG_WEATHERCM
   double wind_x = stationweather.Wind[0];
   double wind_y = stationweather.Wind[1];
   
@@ -223,6 +253,8 @@ void FGApproach::get_active_runway() {
     if (hdg < 0.0)
       hdg += 360.0;
   }
+#else
+  double hdg = stationweather.get_wind_from_heading_deg();
 #endif
   
   FGRunway runway;