]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIFlightPlan.cxx
warnings--
[flightgear.git] / src / AIModel / AIFlightPlan.cxx
index db4061b13d35755ab62daa9e9d8154b87bd60b84..1ffc4328383dac203d0e49b247cee182802da06c 100644 (file)
 //
 // 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 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,8 +49,9 @@ FGAIFlightPlan::FGAIFlightPlan(const string& filename)
   start_time = 0;
   leg = 10;
   gateId = 0;
+  taxiRoute = 0;
   SGPath path( globals->get_fg_root() );
-  path.append( ("/Data/AI/FlightPlans/" + filename).c_str() );
+  path.append( ("/AI/FlightPlans/" + filename).c_str() );
   SGPropertyNode root;
   repeat = false;
 
@@ -93,25 +96,32 @@ FGAIFlightPlan::FGAIFlightPlan(const string& filename)
 // Position computed by the traffic manager, as well
 // as setting speeds and altitude computed by the
 // traffic manager. 
-FGAIFlightPlan::FGAIFlightPlan(FGAIModelEntity *entity,
+FGAIFlightPlan::FGAIFlightPlan(const std::string& p,
                               double course,
                               time_t start,
                               FGAirport *dep,
                               FGAirport *arr,
                               bool firstLeg,
                               double radius,
+                               double alt,
+                               double lat,
+                               double lon,
+                               double speed,
                               const string& fltType,
                               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( "/Data/AI/FlightPlans" );
-  path.append( entity->path );
+  path.append( "/AI/FlightPlans" );
+  path.append( p );
+  
   SGPropertyNode root;
   
   // This is a bit of a hack:
@@ -155,7 +165,7 @@ FGAIFlightPlan::FGAIFlightPlan(FGAIModelEntity *entity,
          }
        }
       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)
@@ -183,7 +193,7 @@ FGAIFlightPlan::FGAIFlightPlan(FGAIModelEntity *entity,
       
       //cerr << "Set leg to : " << leg << endl;  
       wpt_iterator = waypoints.begin();
-      create(dep,arr, leg, entity->altitude, entity->speed, entity->latitude, entity->longitude,
+      create(dep,arr, leg, alt, speed, lat, lon,
             firstLeg, radius, fltType, acType, airline);
       wpt_iterator = waypoints.begin();
       //cerr << "after create: " << (*wpt_iterator)->name << endl;
@@ -292,6 +302,8 @@ FGAIFlightPlan::~FGAIFlightPlan()
   //    delete *(waypoints.begin());
   //    waypoints.erase (waypoints.begin());
   //  }
+  if (taxiRoute)
+    delete taxiRoute;
 }