]> git.mxchange.org Git - flightgear.git/commitdiff
Alasdair Campbell: fix the MK_VIII problems
authorehofman <ehofman>
Thu, 23 Oct 2008 16:43:35 +0000 (16:43 +0000)
committerehofman <ehofman>
Thu, 23 Oct 2008 16:43:35 +0000 (16:43 +0000)
src/Instrumentation/mk_viii.cxx
src/Instrumentation/mk_viii.hxx

index 1deabde7c5ccd1f385a014c742c6a946bfa6f534..d4f20e7c5ef580cda594d7202d4151dc8a2d0c08 100755 (executable)
@@ -4489,10 +4489,10 @@ MK_VIII::TCFHandler::get_azimuth_difference (const FGRunway *_runway)
 // This selection algorithm is not specified in [SPEC], but
 // http://www.egpws.com/general_information/description/runway_select.htm
 // talks about automatic runway selection.
-void
-MK_VIII::TCFHandler::select_runway (const FGAirport *airport,
-                                   FGRunway *_runway)
+FGRunway*
+MK_VIII::TCFHandler::select_runway (const FGAirport *airport)
 {
+  FGRunway* _runway = 0;
   double min_diff = 360;
   
   for (unsigned int r=0; r<airport->numRunways(); ++r) {
@@ -4504,6 +4504,7 @@ MK_VIII::TCFHandler::select_runway (const FGAirport *airport,
       _runway = rwy;
     }
   } // of airport runways iteration
+  return _runway;
 }
 
 bool MK_VIII::TCFHandler::AirportFilter::pass(FGAirport *a)
@@ -4532,15 +4533,14 @@ MK_VIII::TCFHandler::update_runway ()
   // the airport's reference point.
   AirportFilter filter(mk);
   const FGAirport *airport = globals->get_airports()->search(
-      mk_data(gps_latitude).get(), mk_data(gps_longitude).get(),
+      mk_data(gps_longitude).get(), mk_data(gps_latitude).get(),
                        0.5, filter);
 
   if (!airport) return;
   
          has_runway = true;
 
-         FGRunway* _runway;
-         select_runway(airport, _runway);
+         FGRunway* _runway = select_runway(airport);
 
          runway.center.latitude = _runway->latitude();
          runway.center.longitude = _runway->longitude();
index d3d581e649fab712108fae749b8da0402a0903eb..f134084402af57568c91a782d95b9ba2241a277a 100755 (executable)
@@ -1563,7 +1563,7 @@ private:
                                   double to_heading);
     double get_azimuth_difference (const FGRunway *_runway);
 
-    void select_runway (const FGAirport *airport, FGRunway *_runway);
+    FGRunway* select_runway (const FGAirport *airport);
     void update_runway ();
 
     void get_bias_area_edges (Position *edge,