// TODO - At hot 'n high airports this may be 500ft AGL though - need to make this a variable.
if((_pos.getElevationM() - rwy.threshold_pos.getElevationM()) * SG_METER_TO_FEET > 700) {
double cc = 0.0;
// TODO - At hot 'n high airports this may be 500ft AGL though - need to make this a variable.
if((_pos.getElevationM() - rwy.threshold_pos.getElevationM()) * SG_METER_TO_FEET > 700) {
double cc = 0.0;
// turn 1000m out for now, taking other traffic into accout
if(fabs(orthopos.x()) > 900) {
double dd = 0.0;
// turn 1000m out for now, taking other traffic into accout
if(fabs(orthopos.x()) > 900) {
double dd = 0.0;
if(fabs(orthopos.x()) > fabs(dd)) {
//cout << "Turning to downwind, distance from centerline = " << fabs(orthopos.x()) << '\n';
leg = TURN2;
if(fabs(orthopos.x()) > fabs(dd)) {
//cout << "Turning to downwind, distance from centerline = " << fabs(orthopos.x()) << '\n';
leg = TURN2;
- CalculateSoD((tower->GetBaseConstraint(d1) ? d1 : -1000.0), (tower->GetDownwindConstraint(d2) ? d2 : 1000.0 * patternDirection), (patternDirection ? true : false));
+ CalculateSoD(((tower && tower->GetBaseConstraint(d1)) ? d1 : -1000.0), ((tower && tower->GetDownwindConstraint(d2)) ? d2 : 1000.0 * patternDirection), (patternDirection ? true : false));
if(fabs(orthopos.y()) > fabs(bb)) {
//cout << "Turning to base, distance from threshold = " << fabs(orthopos.y()) << '\n';
leg = TURN3;
if(fabs(orthopos.y()) > fabs(bb)) {
//cout << "Turning to base, distance from threshold = " << fabs(orthopos.y()) << '\n';
leg = TURN3;
double d1;
// Make downwind leg position artifically large to avoid any chance of SoD being returned as
// on downwind when we are already on base.
double d1;
// Make downwind leg position artifically large to avoid any chance of SoD being returned as
// on downwind when we are already on base.
- CalculateSoD((tower->GetBaseConstraint(d1) ? d1 : -1000.0), (10000.0 * patternDirection), (patternDirection ? true : false));
+ CalculateSoD(((tower && tower->GetBaseConstraint(d1)) ? d1 : -1000.0), (10000.0 * patternDirection), (patternDirection ? true : false));
void FGAILocalTraffic::TransmitPatternPositionReport(void) {
// airport name + "traffic" + airplane callsign + pattern direction + pattern leg + rwy + ?
void FGAILocalTraffic::TransmitPatternPositionReport(void) {
// airport name + "traffic" + airplane callsign + pattern direction + pattern leg + rwy + ?
pending_transmission = trns;
ConditionalTransmit(60.0, code); // Assume a report of this leg will be invalid if we can't transmit within a minute.
pending_transmission = trns;
ConditionalTransmit(60.0, code); // Assume a report of this leg will be invalid if we can't transmit within a minute.