+bool FGAIFlightPlan::parseProperties(const std::string& filename)
+{
+ SGPath path( globals->get_fg_root() );
+ path.append( "/AI/FlightPlans/" + filename );
+ if (!path.exists()) {
+ return false;
+ }
+
+ SGPropertyNode root;
+ try {
+ readProperties(path.str(), &root);
+ } catch (const sg_exception &e) {
+ SG_LOG(SG_AI, SG_ALERT, "Error reading AI flight plan: " << path.str()
+ << "message:" << e.getFormattedMessage());
+ return false;
+ }
+
+ SGPropertyNode * node = root.getNode("flightplan");
+ for (int i = 0; i < node->nChildren(); i++) {
+ FGAIWaypoint* wpt = new FGAIWaypoint;
+ SGPropertyNode * wpt_node = node->getChild(i);
+ wpt->setName (wpt_node->getStringValue("name", "END" ));
+ wpt->setLatitude (wpt_node->getDoubleValue("lat", 0 ));
+ wpt->setLongitude (wpt_node->getDoubleValue("lon", 0 ));
+ wpt->setAltitude (wpt_node->getDoubleValue("alt", 0 ));
+ wpt->setSpeed (wpt_node->getDoubleValue("ktas", 0 ));
+ wpt->setCrossat (wpt_node->getDoubleValue("crossat", -10000 ));
+ wpt->setGear_down (wpt_node->getBoolValue("gear-down", false ));
+ wpt->setFlaps_down (wpt_node->getBoolValue("flaps-down", false ));
+ wpt->setOn_ground (wpt_node->getBoolValue("on-ground", false ));
+ wpt->setTime_sec (wpt_node->getDoubleValue("time-sec", 0 ));
+ wpt->setTime (wpt_node->getStringValue("time", "" ));
+ wpt->setFinished ((wpt->getName() == "END"));
+ pushBackWaypoint( wpt );
+ }
+
+ wpt_iterator = waypoints.begin();
+ return true;
+}
+
+FGAIWaypoint* const FGAIFlightPlan::getPreviousWaypoint( void ) const