]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIFlightPlanCreateCruise.cxx
commradio: improvements for atis speech
[flightgear.git] / src / AIModel / AIFlightPlanCreateCruise.cxx
index 13df4b6072425b93218866be5b0b6420e5f52fe8..709378f90013bc8d16d5278b4e21962b99f39f8d 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *
  **************************************************************************/
@@ -25,9 +25,8 @@
 
 #include <fstream>
 #include <iostream>
-#include <simgear/route/waypoint.hxx>
 
-#include <Navaids/awynet.hxx>
+#include <Airports/airport.hxx>
 #include <Airports/runways.hxx>
 #include <Airports/dynamics.hxx>
 
@@ -39,7 +38,9 @@
 #include "performancedata.hxx"
 
 using std::iostream;
+using std::string;
 
+/*
 void FGAIFlightPlan::evaluateRoutePart(double deplat,
                                       double deplon,
                                       double arrlat,
@@ -97,7 +98,7 @@ void FGAIFlightPlan::evaluateRoutePart(double deplat,
        }
 }
 
-
+*/
 /*
 void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
                                  FGAirport *arr, double latitude,
@@ -126,7 +127,7 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
     init_waypoint->flaps_down= false;
     init_waypoint->finished  = false;
     init_waypoint->on_ground = false;
-    waypoints.push_back(init_waypoint);
+    pushBackWaypoint(init_waypoint);
     routefile.append("Data/AI/FlightPlans");
     snprintf(buffer, 32, "%s-%s.txt",
             dep->getId().c_str(),
@@ -220,7 +221,7 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
            wpt->flaps_down= false;
            wpt->finished  = false;
            wpt->on_ground = false;
-           waypoints.push_back(wpt);
+           pushBackWaypoint(wpt);
          }
 
          if (!(routefile.exists()))
@@ -273,7 +274,7 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
     wpt->flaps_down= false;
     wpt->finished  = false;
     wpt->on_ground = false;
-    waypoints.push_back(wpt);
+    pushBackWaypoint(wpt);
 }
 */
 
@@ -285,23 +286,28 @@ 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(FGAIAircraft *ac, bool firstFlight, FGAirport *dep, 
+bool FGAIFlightPlan::createCruise(FGAIAircraft *ac, bool firstFlight, FGAirport *dep, 
                                  FGAirport *arr, double latitude, 
                                  double longitude, double speed, 
                                  double alt, const string& fltType)
 {
   double vCruise = ac->getPerformance()->vCruise();
-  waypoint *wpt;
+  FGAIWaypoint *wpt;
   wpt = createInAir(ac, "Cruise", SGGeod::fromDeg(longitude, latitude), alt, vCruise);
-  waypoints.push_back(wpt); 
+  pushBackWaypoint(wpt); 
   
-  string rwyClass = getRunwayClassFromTrafficType(fltType);
+  const string& rwyClass = getRunwayClassFromTrafficType(fltType);
   double heading = ac->getTrafficRef()->getCourse();
   arr->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway, heading);
-  rwy = arr->getRunwayByIdent(activeRunway);
+  FGRunway* rwy = arr->getRunwayByIdent(activeRunway);
+  assert( rwy != NULL );
   // begin descent 110km out
-  SGGeod beginDescentPoint = rwy->pointOnCenterline(-110000);
+  SGGeod beginDescentPoint     = rwy->pointOnCenterline(0);
+  SGGeod secondaryDescentPoint = rwy->pointOnCenterline(-10000);
   
-  wpt = createInAir(ac, "BOD", beginDescentPoint, alt, vCruise);
-  waypoints.push_back(wpt); 
+  wpt = createInAir(ac, "BOD", beginDescentPoint,  alt, vCruise);
+  pushBackWaypoint(wpt); 
+  wpt = createInAir(ac, "BOD2", secondaryDescentPoint, alt, vCruise);
+  pushBackWaypoint(wpt); 
+  return true;
 }