to avoid copying actual string data around.
// from control properties. These default to the initial
// settings in the config file, but can be changed "on the
// fly".
- string lat_mode = props->getStringValue("controls/flight/lateral-mode");
+ const string& lat_mode = props->getStringValue("controls/flight/lateral-mode");
if ( lat_mode == "roll" ) {
double angle
= props->getDoubleValue("controls/flight/target-roll" );
}
}
-string FGAIAircraft::atGate()
+const string& FGAIAircraft::atGate()
{
if ((fp->getLeg() < 3) && trafficRef) {
if (fp->getParkingGate()) {
}
}
- return string();
+ static const string empty;
+ return empty;
}
void FGAIAircraft::handleATCRequests() {
return hdgDiff;
}
-time_t FGAIAircraft::checkForArrivalTime(string wptName) {
+time_t FGAIAircraft::checkForArrivalTime(const string& wptName) {
FGAIWaypoint* curr = 0;
curr = fp->getCurrentWaypoint();
void initializeFlightPlan();
FGAIFlightPlan* GetFlightPlan() const { return fp; };
void ProcessFlightPlan( double dt, time_t now );
- time_t checkForArrivalTime(string wptName);
+ time_t checkForArrivalTime(const string& wptName);
void AccelTo(double speed);
void PitchTo(double angle);
double getBearing(double crse);
void setAcType(const std::string& ac) { acType = ac; };
- std::string getAcType() const { return acType; }
+ const std::string& getAcType() const { return acType; }
void setCompany(const std::string& comp) { company = comp;};
virtual const char* getTypeString(void) const { return "aircraft"; }
- std::string GetTransponderCode() { return transponderCode; };
+ const std::string& GetTransponderCode() { return transponderCode; };
void SetTransponderCode(const std::string& tc) { transponderCode = tc;};
// included as performance data needs them, who else?
inline double getVerticalSpeed() const { return vs; };
inline double altitudeAGL() const { return props->getFloatValue("position/altitude-agl-ft");};
inline double airspeed() const { return props->getFloatValue("velocities/airspeed-kt");};
- std::string atGate();
+ const std::string& atGate();
int getTakeOffStatus() { return takeOffStatus; };
// sound initialization
if (fgGetBool("/sim/sound/aimodels/enabled",false))
{
- string fxpath = _modeldata->get_sound_path();
+ const string& fxpath = _modeldata->get_sound_path();
if (fxpath != "")
{
props->setStringValue("sim/sound/path", fxpath.c_str());
model = _selected_ac;
} else {
model = ai->getChild(i);
- string path = ai->getPath();
+ //const string& path = ai->getPath();
const string name = model->getStringValue("name");
if (!model->nChildren()){
std::vector<SGPropertyNode_ptr> props = scFileNode->getChildren("parking-pos");
std::vector<SGPropertyNode_ptr>::const_iterator it;
for (it = props.begin(); it != props.end(); ++it) {
- string name = (*it)->getStringValue("name", "unnamed");
+ const string name = (*it)->getStringValue("name", "unnamed");
// Transform to the right coordinate frame, configuration is done in
// the usual x-back, y-right, z-up coordinates, computations
// in the simulation usual body x-forward, y-right, z-down coordinates
void FGAICarrier::UpdateJBD(double dt, double jbd_transition_time) {
- string launchbar_state = _launchbar_state_node->getStringValue();
+ const string launchbar_state = _launchbar_state_node->getStringValue();
double step = 0;
if (launchbar_state == "Engaged"){
trackLength = 0;
}
-bool FGAIWaypoint::contains(string target) {
+bool FGAIWaypoint::contains(const string& target) {
size_t found = name.find(target);
if (found == string::npos)
return false;
return 0;
}
-double FGAIFlightPlan::checkTrackLength(string wptName) {
+double FGAIFlightPlan::checkTrackLength(const string& wptName) {
// skip the first two waypoints: first one is behind, second one is partially done;
double trackDistance = 0;
wpt_vector_iterator wptvec = waypoints.begin();
public:
FGAIWaypoint();
~FGAIWaypoint() {};
- void setName (std::string nam) { name = nam; };
+ void setName (const std::string& nam) { name = nam; };
void setLatitude (double lat);
void setLongitude (double lon);
void setAltitude (double alt);
void setRouteIndex (int rte) { routeIndex = rte; };
void setTime_sec (double ts ) { time_sec = ts; };
void setTrackLength (double tl ) { trackLength = tl; };
- void setTime (std::string tme) { time = tme; };
+ void setTime (const std::string& tme) { time = tme; };
- bool contains(std::string name);
+ bool contains(const std::string& name);
- std::string getName () { return name; };
+ const std::string& getName() { return name; };
const SGGeod& getPos () { return pos; };
double getLatitude ();
double getLongitude ();
bool isFinished () { return finished; };
double getTime_sec () { return time_sec; };
double getTrackLength() { return trackLength; };
- std::string getTime () { return time; };
+ const std::string& getTime () { return time; };
};
double getBearing(FGAIWaypoint* previous, FGAIWaypoint* next) const;
double getBearing(const SGGeod& aPos, FGAIWaypoint* next) const;
- double checkTrackLength(std::string wptName);
+ double checkTrackLength(const std::string& wptName);
time_t getStartTime() const { return start_time; }
time_t getArrivalTime() const { return arrivalTime; }
int getRouteIndex(int i); // returns the AI related index of this current routes.
- std::string getRunway() { return activeRunway; }
+ const std::string& getRunway() { return activeRunway; }
bool isActive(time_t time) {return time >= this->getStartTime();}
void incrementLeg() { leg++;};
- void setRunway(std::string rwy) { activeRunway = rwy; };
- std::string getRunwayClassFromTrafficType(std::string fltType);
+ void setRunway(const std::string& rwy) { activeRunway = rwy; };
+ const char* getRunwayClassFromTrafficType(const std::string& fltType);
void addWaypoint(FGAIWaypoint* wpt) { waypoints.push_back(wpt); };
- void setName(std::string n) { name = n; };
- std::string getName() { return name; };
+ void setName(const std::string& n) { name = n; };
+ const std::string& getName() { return name; };
void setSID(FGAIFlightPlan* fp) { sid = fp;};
FGAIFlightPlan* getSID() { return sid; };
void setGate(ParkingAssignment pka);
FGParking* getParkingGate();
+
private:
FGAIFlightPlan *sid;
typedef std::vector <FGAIWaypoint*> wpt_vector_type;
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()) {
// 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";
}
wpt = createInAir(ac, "Cruise", SGGeod::fromDeg(longitude, latitude), alt, vCruise);
pushBackWaypoint(wpt);
- string rwyClass = getRunwayClassFromTrafficType(fltType);
+ const string& rwyClass = getRunwayClassFromTrafficType(fltType);
double heading = ac->getTrafficRef()->getCourse();
arr->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway, heading);
FGRunway* rwy = arr->getRunwayByIdent(activeRunway);
if (strcmp(n->getName(), "scenario"))
continue;
- string name = n->getStringValue();
+ const string& name = n->getStringValue();
if (name.empty())
continue;
if (strcmp(scEntry->getName(), "entry"))
continue;
- std::string type = scEntry->getStringValue("type", "aircraft");
+ const std::string& type = scEntry->getStringValue("type", "aircraft");
if (type == "tanker") { // refueling scenarios
FGAITanker* tanker = new FGAITanker;
} catch (const sg_exception &t) {
SG_LOG(SG_AI, SG_ALERT, "Failed to load scenario '"
<< path.str() << "': " << t.getFormattedMessage());
- return 0;
}
+ return 0;
}
bool
for (int i = 0 ; (!found) && i < root->nChildren() ; i++) {
SGPropertyNode *aiEntry = root->getChild( i );
if ( !strcmp( aiEntry->getName(), "scenario" ) ) {
- string filename = aiEntry->getStringValue();
+ const string& filename = aiEntry->getStringValue();
SGPropertyNode_ptr scenarioTop = loadScenarioFile(filename);
if (scenarioTop) {
SGPropertyNode* scenarios = scenarioTop->getChild("scenario");
if (scenarios) {
for (int i = 0; i < scenarios->nChildren(); i++) {
SGPropertyNode* scEntry = scenarios->getChild(i);
- std::string type = scEntry->getStringValue("type");
- std::string pnumber = scEntry->getStringValue("pennant-number");
- std::string name = scEntry->getStringValue("name");
+ const std::string& type = scEntry->getStringValue("type");
+ const std::string& pnumber = scEntry->getStringValue("pennant-number");
+ const std::string& name = scEntry->getStringValue("name");
if (type == "carrier" && (pnumber == id || name == id)) {
SGSharedPtr<FGAICarrier> carrier = new FGAICarrier;
carrier->readFromScenario(scEntry);
isTanker = false; // do this until this property is
// passed over the net
- string str1 = _getCallsign();
- string str2 = "MOBIL";
+ const string& str1 = _getCallsign();
+ const string str2 = "MOBIL";
string::size_type loc1= str1.find( str2, 0 );
if ( (loc1 != string::npos && str2 != "") ){
setRudder(scFileNode->getFloatValue("rudder", 0.0));
setName(scFileNode->getStringValue("name", "Titanic"));
setRadius(scFileNode->getDoubleValue("turn-radius-ft", 2000));
- std::string flightplan = scFileNode->getStringValue("flightplan");
+ const std::string& flightplan = scFileNode->getStringValue("flightplan");
setRepeat(scFileNode->getBoolValue("repeat", false));
setRestart(scFileNode->getBoolValue("restart", false));
setStartTime(scFileNode->getStringValue("time", ""));
if (_fp_init)
ProcessFlightPlan(dt);
- string type = getTypeString();
+ const string& type = getTypeString();
double alpha;
double rudder_limit;
return _db[acType];
}
- string alias = findAlias(acType);
+ const string& alias = findAlias(acType);
if (_db.find(alias) != _db.end()) {
return _db[alias];
}
if (!strcmp(db_node->getName(), "aircraft")) {
PerformanceData* data = NULL;
if (db_node->hasChild("base")) {
- string baseName = db_node->getStringValue("base");
+ const string& baseName = db_node->getStringValue("base");
PerformanceData* baseData = _db[baseName];
if (!baseData) {
SG_LOG(SG_AI, SG_ALERT,
}
data->initFromProps(db_node);
- string name = db_node->getStringValue("type", "heavy_jet");
+ const string& name = db_node->getStringValue("type", "heavy_jet");
registerPerformanceData(name, data);
} else if (!strcmp(db_node->getName(), "alias")) {
- string alias(db_node->getStringValue("alias"));
+ const string& alias(db_node->getStringValue("alias"));
if (alias.empty()) {
SG_LOG(SG_AI, SG_ALERT, "performance DB alias entry with no <alias> definition");
continue;
}
BOOST_FOREACH(SGPropertyNode* matchNode, db_node->getChildren("match")) {
- string match(matchNode->getStringValue());
+ const string& match(matchNode->getStringValue());
_aliases.push_back(StringPair(match, alias));
}
} else {
} // of nodes iteration
}
-string PerformanceDB::findAlias(const string& acType) const
+const string& PerformanceDB::findAlias(const string& acType) const
{
BOOST_FOREACH(const StringPair& alias, _aliases) {
if (acType.find(alias.first) == 0) { // matched!
}
} // of alias iteration
- return string();
+ static const string empty;
+ return empty;
}
private:
std::map<std::string, PerformanceData*> _db;
- std::string findAlias(const std::string& acType) const;
+ const std::string& findAlias(const std::string& acType) const;
typedef std::pair<std::string, std::string> StringPair;
/// alias list, to allow type/class names to share data. This is used to merge
yaw_offset = 0.0;
//out[0] = out[1] = out[2] = 0;
- string contents_node;
+ //string contents_node;
contrail_altitude = 30000;
_count = 0;
_found_sub = true;
if (trigger && (*submodel_iterator)->count != 0) {
//int id = (*submodel_iterator)->id;
- string name = (*submodel_iterator)->name;
+ //const string& name = (*submodel_iterator)->name;
SG_LOG(SG_AI, SG_DEBUG,
"Submodels release: " << (*submodel_iterator)->id
if (path) {
const int id = 0;
- string Path = path->getStringValue();
+ const string& Path = path->getStringValue();
bool Seviceable =_serviceable_node->getBoolValue();
setData(id, Path, Seviceable);
}
int id = sm->id;
//int sub_id = sm->sub_id;
- string name = sm->name;
+ //const string& name = sm->name;
if (sm->speed_node != 0)
}
int id = (*sm_list_itr)->getID();
- string type = (*sm_list_itr)->getTypeString();
bool serviceable = (*sm_list_itr)->_getServiceable();
+ //string type = (*sm_list_itr)->getTypeString();
//cout << "loadAI: type " << type << " path "<< path << " serviceable " << serviceable << endl;
setData(id, path, serviceable);
-void FGSubmodelMgr::setData(int id, string& path, bool serviceable)
+void FGSubmodelMgr::setData(int id, const string& path, bool serviceable)
{
SGPropertyNode root;
sm->prop->tie("serviceable", SGRawValuePointer<bool>(&(sm->serviceable)));
sm->prop->tie("random", SGRawValuePointer<bool>(&(sm->random)));
sm->prop->tie("slaved", SGRawValuePointer<bool>(&(sm->slaved)));
- string name = sm->name;
+ const string& name = sm->name;
sm->prop->setStringValue("name", name.c_str());
- string submodel = sm->submodel;
+ const string& submodel = sm->submodel;
sm->prop->setStringValue("submodel", submodel.c_str());
- string force_path = sm->force_path;
+ const string& force_path = sm->force_path;
sm->prop->setStringValue("force_path", force_path.c_str());
//cout << "set force_path Sub " << force_path << endl;
}
}
-void FGSubmodelMgr::setSubData(int id, string& path, bool serviceable)
+void FGSubmodelMgr::setSubData(int id, const string& path, bool serviceable)
{
SGPropertyNode root;
SGPath config = globals->resolve_aircraft_path(path);
sm->prop->tie("random", SGRawValuePointer<bool>(&(sm->random)));
sm->prop->tie("slaved", SGRawValuePointer<bool>(&(sm->slaved)));
- string name = sm->name;
+ const string& name = sm->name;
sm->prop->setStringValue("name", name.c_str());
- string submodel = sm->submodel;
+ const string& submodel = sm->submodel;
sm->prop->setStringValue("submodel-path", submodel.c_str());
// cout << " set submodel path AI" << submodel<< endl;
- string force_path = sm->force_path;
+ const string& force_path = sm->force_path;
sm->prop->setStringValue("force_path", force_path.c_str());
//cout << "set force_path AI" << force_path << endl;
submodel_iterator = submodels.begin();
while (submodel_iterator != submodels.end()) {
- string submodel = (*submodel_iterator)->submodel;
+ const string& submodel = (*submodel_iterator)->submodel;
if (!submodel.empty()) {
//int id = (*submodel_iterator)->id;
bool serviceable = true;
SGPropertyNode_ptr path_node = sub_node->getChild("path", 0, true);
SGPropertyNode_ptr callsign_node = a_node->getChild("callsign", 0, true);
- string callsign = callsign_node->getStringValue();
-
+ //const string& callsign = callsign_node->getStringValue();
//cout << "Submodels: model added - " << callsign <<" read callsign "<< endl;
return;
model = _selected_ac;
} else {
model = ai->getChild(i);
- string path = ai->getPath();
- const string name = model->getStringValue("name");
+ //const string& path = ai->getPath();
+ //const string& name = model->getStringValue("name");
int parent_id = model->getIntValue("id");
if (!model->nChildren()){
continue;
void loadAI();
void loadSubmodels();
- void setData(int id, std::string& path, bool serviceable);
- void setSubData(int id, std::string& path, bool serviceable);
+ void setData(int id, const std::string& path, bool serviceable);
+ void setSubData(int id, const std::string& path, bool serviceable);
void valueChanged (SGPropertyNode *);
void transform(submodel *);
void setParentNode(int parent_id);
public:
FGScheduledFlight();
FGScheduledFlight(const FGScheduledFlight &other);
- // FGScheduledFlight(const string);
- FGScheduledFlight(const string& cs,
- const string& fr,
- const string& depPrt,
- const string& arrPrt,
- int cruiseAlt,
- const string& deptime,
- const string& arrtime,
- const string& rep,
- const string& reqAC
- );
+ // FGScheduledFlight(const std::string);
+ FGScheduledFlight(const std::string& cs,
+ const std::string& fr,
+ const std::string& depPrt,
+ const std::string& arrPrt,
+ int cruiseAlt,
+ const std::string& deptime,
+ const std::string& arrtime,
+ const std::string& rep,
+ const std::string& reqAC
+ );
~FGScheduledFlight();
void update();
- bool initializeAirports();
+ bool initializeAirports();
void adjustTime(time_t now);
time_t getDepartureTime() { return departureTime; };
time_t getArrivalTime () { return arrivalTime; };
- void setDepartureAirport(string port) { depId = port; };
- void setArrivalAirport (string port) { arrId = port; };
+ void setDepartureAirport(const std::string& port) { depId = port; };
+ void setArrivalAirport (const std::string& port) { arrId = port; };
FGAirport *getDepartureAirport();
FGAirport *getArrivalAirport ();
{
return (departureTime < other.departureTime);
};
- string& getFlightRules() { return fltRules; };
+ const std::string& getFlightRules() { return fltRules; };
- time_t processTimeString(const string& time);
- const string& getCallSign() {return callsign; };
- const string& getRequirement() { return requiredAircraft; }
+ time_t processTimeString(const std::string& time);
+ const std::string& getCallSign() {return callsign; };
+ const std::string& getRequirement() { return requiredAircraft; }
- void lock() { available = false; };
- void release() { available = true; };
+ void lock() { available = false; };
+ void release() { available = true; };
bool isAvailable() { return available; };
- void setCallSign(string val) { callsign = val; };
- void setFlightRules(string val) { fltRules = val; };
+ void setCallSign(const std::string& val) { callsign = val; };
+ void setFlightRules(const std::string& val) { fltRules = val; };
};
typedef std::vector<FGScheduledFlight*> FGScheduledFlightVec;
//score = 0;
}
-/*
-FGAISchedule::FGAISchedule(string mdl,
- string liv,
- string reg,
- bool hvy,
- string act,
- string arln,
- string mclass,
- string fltpe,
- double rad,
- double grnd,
- int scre,
- FGScheduledFlightVec flt)*/
-FGAISchedule::FGAISchedule(string model,
- string lvry,
- string port,
- string reg,
- string flightId,
+
+FGAISchedule::FGAISchedule(const string& model,
+ const string& lvry,
+ const string& port,
+ const string& reg,
+ const string& flightId,
bool hvy,
- string act,
- string arln,
- string mclass,
- string fltpe,
+ const string& act,
+ const string& arln,
+ const string& mclass,
+ const string& fltpe,
double rad,
double grnd)
{
FGScheduledFlight* flight = flights.front();
if (!deptime) {
deptime = flight->getDepartureTime();
- //cerr << "Settiing departure time " << deptime << endl;
+ //cerr << "Setting departure time " << deptime << endl;
}
if (aiAircraft) {
**************************************************************************/
/**************************************************************************
- * This file contains the definition of the class Shedule.
+ * This file contains the definition of the class Schedule.
*
- * A schedule is basically a number of scheduled flights, wich can be
+ * A schedule is basically a number of scheduled flights, which can be
* assigned to an AI aircraft.
**************************************************************************/
SGSharedPtr<FGAIAircraft> aiAircraft;
public:
FGAISchedule(); // constructor
- FGAISchedule(string model,
- string livery,
- string homePort,
- string registration,
- string flightId,
+ FGAISchedule(const std::string& model,
+ const std::string& livery,
+ const std::string& homePort,
+ const std::string& registration,
+ const std::string& flightId,
bool heavy,
- string acType,
- string airline,
- string m_class,
- string flight_type,
+ const std::string& acType,
+ const std::string& airline,
+ const std::string& m_class,
+ const std::string& flight_type,
double radius,
double offset); // construct & init
FGAISchedule(const FGAISchedule &other); // copy constructor
int getCruiseAlt () { return (*flights.begin())->getCruiseAlt (); };
double getRadius () { return radius; };
double getGroundOffset () { return groundOffset;};
- const string& getFlightType () { return flightType;};
- const string& getAirline () { return airline; };
- const string& getAircraft () { return acType; };
- const string& getCallSign () { return (*flights.begin())->getCallSign (); };
- const string& getRegistration () { return registration;};
- const string& getFlightRules () { return (*flights.begin())->getFlightRules (); };
+ const std::string& getFlightType () { return flightType;};
+ const std::string& getAirline () { return airline; };
+ const std::string& getAircraft () { return acType; };
+ const std::string& getCallSign () { return (*flights.begin())->getCallSign (); };
+ const std::string& getRegistration () { return registration;};
+ const std::string& getFlightRules () { return (*flights.begin())->getFlightRules (); };
bool getHeavy () { return heavy; };
double getCourse () { return courseToDest; };
unsigned int getRunCount () { return runCount; };
double getScore () { return score; };
void setHeading ();
void assign (FGScheduledFlight *ref) { flights.push_back(ref); };
- void setFlightType (string val ) { flightType = val; };
- FGScheduledFlight*findAvailableFlight (const string ¤tDestination, const string &req, time_t min=0, time_t max=0);
- // used to sort in decending order of score: I've probably found a better way to
- // decending order sorting, but still need to test that.
+ void setFlightType (const std::string& val) { flightType = val; };
+ FGScheduledFlight*findAvailableFlight (const std::string& currentDestination, const std::string &req, time_t min=0, time_t max=0);
+ // used to sort in descending order of score: I've probably found a better way to
+ // descending order sorting, but still need to test that.
bool operator< (const FGAISchedule &other) const;
void taint() { valid = false; };
- int getLastUsed() { return lastRun; };
- void setLastUsed(unsigned int val) {lastRun = val; };
+ int getLastUsed() { return lastRun; };
+ void setLastUsed(unsigned int val) {lastRun = val; };
//void * getAiRef () { return AIManagerRef; };
//FGAISchedule* getAddress () { return this;};
if (fgGetBool("/sim/traffic-manager/heuristics")) {
SGPath cacheData(globals->get_fg_home());
cacheData.append("ai");
- string airport = fgGetString("/sim/presets/airport-id");
+ const string airport = fgGetString("/sim/presets/airport-id");
if ((airport) != "") {
char buffer[128];
assert(!doingInit);
doingInit = true;
- if (string(fgGetString("/sim/traffic-manager/datafile")) == string("")) {
+ if (string(fgGetString("/sim/traffic-manager/datafile")).empty()) {
scheduleParser.reset(new ScheduleParseThread(this));
scheduleParser->setTrafficDir(SGPath(globals->get_fg_root(), "AI/Traffic"));
scheduleParser->start();
}
for(currAircraft = scheduledAircraft.begin(); currAircraft != scheduledAircraft.end(); ++currAircraft) {
- string registration = (*currAircraft)->getRegistration();
+ const string& registration = (*currAircraft)->getRegistration();
HeuristicMapIterator itr = heurMap.find(registration);
if (itr != heurMap.end()) {
(*currAircraft)->setrunCount(itr->second.runCount);