Trying to bullet-proof the traffic code.
This commit is contained in:
parent
0f590280c7
commit
865bb365ed
4 changed files with 53 additions and 9 deletions
|
@ -107,6 +107,11 @@ void FGGroundController::announcePosition(int id,
|
||||||
double radius, int leg,
|
double radius, int leg,
|
||||||
FGAIAircraft * aircraft)
|
FGAIAircraft * aircraft)
|
||||||
{
|
{
|
||||||
|
if (!aircraft || !aircraft->getPerformance()) {
|
||||||
|
SG_LOG(SG_ATC, SG_ALERT, "announcePosition: missing aircraft performance");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search search if the current id alread has an entry
|
// Search search if the current id alread has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
|
|
|
@ -57,7 +57,10 @@ FGTaxiSegment::FGTaxiSegment(FGTaxiNode* aStart, FGTaxiNode* aEnd) :
|
||||||
index(0),
|
index(0),
|
||||||
oppositeDirection(0)
|
oppositeDirection(0)
|
||||||
{
|
{
|
||||||
};
|
if (!aStart || !aEnd) {
|
||||||
|
throw sg_exception("Missing node arguments creating FGTaxiSegment");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SGGeod FGTaxiSegment::getCenter() const
|
SGGeod FGTaxiSegment::getCenter() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -505,17 +505,53 @@ bool FGAISchedule::next()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t FGAISchedule::getDepartureTime() { return (*flights.begin())->getDepartureTime (); }
|
time_t FGAISchedule::getDepartureTime()
|
||||||
|
{
|
||||||
|
if (flights.empty())
|
||||||
|
return 0;
|
||||||
|
|
||||||
FGAirport *FGAISchedule::getDepartureAirport() { return (*flights.begin())->getDepartureAirport(); }
|
return (*flights.begin())->getDepartureTime ();
|
||||||
|
}
|
||||||
|
|
||||||
FGAirport *FGAISchedule::getArrivalAirport() { return (*flights.begin())->getArrivalAirport (); }
|
FGAirport *FGAISchedule::getDepartureAirport()
|
||||||
|
{
|
||||||
|
if (flights.empty())
|
||||||
|
return 0;
|
||||||
|
|
||||||
int FGAISchedule::getCruiseAlt() { return (*flights.begin())->getCruiseAlt (); }
|
return (*flights.begin())->getDepartureAirport();
|
||||||
|
}
|
||||||
|
|
||||||
const std::string &FGAISchedule::getCallSign() { return (*flights.begin())->getCallSign (); }
|
FGAirport *FGAISchedule::getArrivalAirport()
|
||||||
|
{
|
||||||
|
if (flights.empty())
|
||||||
|
return 0;
|
||||||
|
|
||||||
const std::string &FGAISchedule::getFlightRules() { return (*flights.begin())->getFlightRules (); }
|
return (*flights.begin())->getArrivalAirport ();
|
||||||
|
}
|
||||||
|
|
||||||
|
int FGAISchedule::getCruiseAlt()
|
||||||
|
{
|
||||||
|
if (flights.empty())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return (*flights.begin())->getCruiseAlt ();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string FGAISchedule::getCallSign()
|
||||||
|
{
|
||||||
|
if (flights.empty())
|
||||||
|
return std::string();
|
||||||
|
|
||||||
|
return (*flights.begin())->getCallSign ();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string FGAISchedule::getFlightRules()
|
||||||
|
{
|
||||||
|
if (flights.empty())
|
||||||
|
return std::string();
|
||||||
|
|
||||||
|
return (*flights.begin())->getFlightRules ();
|
||||||
|
}
|
||||||
|
|
||||||
FGScheduledFlight* FGAISchedule::findAvailableFlight (const string ¤tDestination,
|
FGScheduledFlight* FGAISchedule::findAvailableFlight (const string ¤tDestination,
|
||||||
const string &req,
|
const string &req,
|
||||||
|
|
|
@ -118,9 +118,9 @@ class FGAISchedule
|
||||||
const std::string& getFlightType () { return flightType;};
|
const std::string& getFlightType () { return flightType;};
|
||||||
const std::string& getAirline () { return airline; };
|
const std::string& getAirline () { return airline; };
|
||||||
const std::string& getAircraft () { return acType; };
|
const std::string& getAircraft () { return acType; };
|
||||||
const std::string& getCallSign ();
|
std::string getCallSign ();
|
||||||
const std::string& getRegistration () { return registration;};
|
const std::string& getRegistration () { return registration;};
|
||||||
const std::string& getFlightRules ();
|
std::string getFlightRules ();
|
||||||
bool getHeavy () { return heavy; };
|
bool getHeavy () { return heavy; };
|
||||||
double getCourse () { return courseToDest; };
|
double getCourse () { return courseToDest; };
|
||||||
unsigned int getRunCount () { return runCount; };
|
unsigned int getRunCount () { return runCount; };
|
||||||
|
|
Loading…
Reference in a new issue