]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIFlightPlan.cxx
Ground network distance tracking code. AIAircraft taxiing at airports
[flightgear.git] / src / AIModel / AIFlightPlan.cxx
index 27cc98602a46ef19d0e65c1c54f8091b6d4fb5b1..8f03b93a7d4e58037af1ba7e6f664a8b0f861e4b 100644 (file)
@@ -16,7 +16,9 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/debug/logstream.hxx>
@@ -47,6 +49,7 @@ FGAIFlightPlan::FGAIFlightPlan(const string& filename)
   start_time = 0;
   leg = 10;
   gateId = 0;
+  taxiRoute = 0;
   SGPath path( globals->get_fg_root() );
   path.append( ("/AI/FlightPlans/" + filename).c_str() );
   SGPropertyNode root;
@@ -108,14 +111,17 @@ FGAIFlightPlan::FGAIFlightPlan(const std::string& p,
                               const string& acType,
                               const string& airline)
 {
+  repeat = false;
   leg = 10;
   gateId=0;
+  taxiRoute = 0;
   start_time = start;
   bool useInitialWayPoint = true;
   bool useCurrentWayPoint = false;
   SGPath path( globals->get_fg_root() );
   path.append( "/AI/FlightPlans" );
   path.append( p );
+  
   SGPropertyNode root;
   
   // This is a bit of a hack:
@@ -159,7 +165,7 @@ FGAIFlightPlan::FGAIFlightPlan(const std::string& p,
          }
        }
       catch (const sg_exception &e) {
-       SG_LOG(SG_GENERAL, SG_ALERT,
+       SG_LOG(SG_GENERAL, SG_WARN,
               "Error reading AI flight plan: ");
        cerr << "Errno = " << errno << endl;
        if (errno == ENOENT)
@@ -290,12 +296,8 @@ FGAIFlightPlan::FGAIFlightPlan(const std::string& p,
 FGAIFlightPlan::~FGAIFlightPlan()
 {
   deleteWaypoints();
-  //waypoints.clear();
-  //while (waypoints.begin() != waypoints.end())
-  //  {
-  //    delete *(waypoints.begin());
-  //    waypoints.erase (waypoints.begin());
-  //  }
+  if (taxiRoute)
+    delete taxiRoute;
 }
 
 
@@ -483,3 +485,20 @@ void FGAIFlightPlan::restart()
 {
   wpt_iterator = waypoints.begin();
 }
+
+
+void FGAIFlightPlan::deleteTaxiRoute() 
+{
+  if (taxiRoute)
+    delete taxiRoute;
+  taxiRoute = 0;
+}
+
+
+int FGAIFlightPlan::getRouteIndex(int i) {
+  if ((i > 0) && (i < waypoints.size())) {
+    return waypoints[i]->routeIndex;
+  }
+  else
+    return 0;
+}