]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIFlightPlanCreateCruise.cxx
Port over remaining Point3D usage to the more type and unit safe SG* classes.
[flightgear.git] / src / AIModel / AIFlightPlanCreateCruise.cxx
index d2fc62473be08e4e2b5caf54b63f29cc018a007d..4f714cc8cd3f13af267ceb0a976e5aa3d0108ded 100755 (executable)
@@ -26,8 +26,7 @@
 #include <fstream>
 #include <iostream>
 #include "AIFlightPlan.hxx"
-#include <simgear/math/polar3d.hxx>
-#include <simgear/math/sg_geodesy.hxx>
+#include "AIAircraft.hxx"
 #include <simgear/route/waypoint.hxx>
 
 #include <Navaids/awynet.hxx>
@@ -310,21 +309,22 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
  * Note that this is the original version that does not 
  * do any dynamic route computation.
  ******************************************************************/
-void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep, 
+void FGAIFlightPlan::createCruise(FGAIAircraft *ac, bool firstFlight, FGAirport *dep, 
                                  FGAirport *arr, double latitude, 
                                  double longitude, double speed, 
                                  double alt, const string& fltType)
 {
   waypoint *wpt;
-  wpt = createInAir("Cruise", SGGeod::fromDeg(longitude, latitude), alt, speed);
+  wpt = createInAir(ac, "Cruise", SGGeod::fromDeg(longitude, latitude), alt, speed);
   waypoints.push_back(wpt); 
   
   string rwyClass = getRunwayClassFromTrafficType(fltType);
-  arr->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway);
+  double heading = ac->getTrafficRef()->getCourse();
+  arr->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway, heading);
   rwy = arr->getRunwayByIdent(activeRunway);
   // begin descent 110km out
   SGGeod beginDescentPoint = rwy->pointOnCenterline(-110000);
   
-  wpt = createInAir("BOD", beginDescentPoint, alt, speed);
+  wpt = createInAir(ac, "BOD", beginDescentPoint, alt, speed);
   waypoints.push_back(wpt); 
 }