#endif
#include <cstdlib>
+#include <cstdio>
#include "AIFlightPlan.hxx"
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx>
-#include <Airports/simple.hxx>
+#include <Airports/airport.hxx>
#include <Airports/runways.hxx>
#include <Airports/dynamics.hxx>
#include "AIAircraft.hxx"
#include <FDM/LaRCsim/basic_aero.h>
#include <Navaids/navrecord.hxx>
+using std::string;
/* FGAIFlightPlan::create()
* dynamically create a flight plan for AI traffic, based on data provided by the
SG_LOG(SG_AI, SG_ALERT,
"AIFlightPlan::create() attempting to create unknown leg"
" this is probably an internal program error");
+ break;
}
wpt_iterator = waypoints.begin() + currWpt;
//don't increment leg right away, but only once we pass the actual last waypoint that was created.
}
}
- string rwyClass = getRunwayClassFromTrafficType(fltType);
+ const string& rwyClass = getRunwayClassFromTrafficType(fltType);
// Only set this if it hasn't been set by ATC already.
if (activeRunway.empty()) {
//cerr << "Building taxi route" << endl;
while (taxiRoute.next(&node)) {
char buffer[10];
- snprintf(buffer, 10, "%ld", node);
+ snprintf(buffer, 10, "%lld", (long long int) node);
FGTaxiNode *tn =
apt->getDynamics()->getGroundNetwork()->findNode(node);
FGAIWaypoint *wpt =
for (int i = 0; i < size - 2; i++) {
taxiRoute.next(&node);
char buffer[10];
- snprintf(buffer, 10, "%ld", node);
+ snprintf(buffer, 10, "%lld", (long long int) node);
FGTaxiNode *tn = gn->findNode(node);
FGAIWaypoint *wpt =
createOnGround(ac, buffer, tn->geod(), apt->getElevation(),
// NOTE: DT (2009-01-18: IIRC, this is currently already the case,
// because the getActive runway function takes care of that.
if (firstFlight) {
- string rwyClass = getRunwayClassFromTrafficType(fltType);
+ const string& rwyClass = getRunwayClassFromTrafficType(fltType);
double heading = ac->getTrafficRef()->getCourse();
apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway,
heading);
double vClimb = ac->getPerformance()->vClimb();
if (firstFlight) {
- string rwyClass = getRunwayClassFromTrafficType(fltType);
+ const string& rwyClass = getRunwayClassFromTrafficType(fltType);
double heading = ac->getTrafficRef()->getCourse();
apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway,
heading);
double vApproach = ac->getPerformance()->vApproach();
//Beginning of Descent
- string rwyClass = getRunwayClassFromTrafficType(fltType);
+ const string& rwyClass = getRunwayClassFromTrafficType(fltType);
double heading = ac->getTrafficRef()->getCourse();
apt->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway,
heading);
if (reposition) {
double tempDistance;
//double minDistance = HUGE_VAL;
- string wptName;
+ //string wptName;
tempDistance = SGGeodesy::distanceM(current, initialTarget);
time_t eta =
tempDistance / ((vDescent * SG_NM_TO_METER) / 3600.0) + now;
* - ul (ultralight: I can imagine that these may share a runway with ga on some airports)
* - mil (all military traffic)
*/
-string FGAIFlightPlan::getRunwayClassFromTrafficType(string fltType)
+const char* FGAIFlightPlan::getRunwayClassFromTrafficType(const string& fltType)
{
if ((fltType == "gate") || (fltType == "cargo")) {
- return string("com");
+ return "com";
}
if (fltType == "ga") {
- return string("gen");
+ return "gen";
}
if (fltType == "ul") {
- return string("ul");
+ return "ul";
}
if ((fltType == "mil-fighter") || (fltType == "mil-transport")) {
- return string("mil");
+ return "mil";
}
- return string("com");
+ return "com";
}