Skip to content

Commit

Permalink
use string length to check for a tracking controller
Browse files Browse the repository at this point in the history
determine Mode S eligibility with the tracking controller, if available and revert to own controller only if none is tracking
resolves #53
  • Loading branch information
kusterjs committed Dec 7, 2024
1 parent 5fdc45e commit 615306a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CCAMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ void CCAMS::AssignAutoSquawk(CFlightPlan& FlightPlan)
if (_stricmp(RadarTarget.GetCallsign(), FlightPlan.GetCallsign()) == 0)
continue;
else if (_stricmp(RadarTarget.GetCorrelatedFlightPlan().GetControllerAssignedData().GetSquawk(), FlightPlan.GetControllerAssignedData().GetSquawk()) == 0
&& RadarTarget.GetCorrelatedFlightPlan().GetTrackingControllerCallsign() > 0)
&& strlen(RadarTarget.GetCorrelatedFlightPlan().GetTrackingControllerCallsign()) > 0)
{
PendingSquawks.insert(std::make_pair(RadarTarget.GetCallsign(), std::async(LoadWebSquawk,
RadarTarget.GetCorrelatedFlightPlan(), ControllerMyself(), collectUsedCodes(RadarTarget.GetCorrelatedFlightPlan()), IsADEPvicinity(RadarTarget.GetCorrelatedFlightPlan()), GetConnectionType())));
Expand Down Expand Up @@ -1016,7 +1016,7 @@ bool CCAMS::IsEligibleSquawkModeS(const EuroScopePlugIn::CFlightPlan& FlightPlan
//return isAcModeS(FlightPlan) && isApModeS(FlightPlan.GetFlightPlanData().GetDestination()) &&
// (isApModeS(FlightPlan.GetFlightPlanData().GetOrigin()) || !isADEPvicinity(FlightPlan));
return IsAcModeS(FlightPlan) && IsApModeS(FlightPlan.GetFlightPlanData().GetDestination()) &&
(IsApModeS(FlightPlan.GetFlightPlanData().GetOrigin()) || (!IsADEPvicinity(FlightPlan) && IsApModeS(ControllerMyself().GetCallsign())));
(IsApModeS(FlightPlan.GetFlightPlanData().GetOrigin()) || (!IsADEPvicinity(FlightPlan) && (strlen(FlightPlan.GetTrackingControllerCallsign()) > 0) ? IsApModeS(FlightPlan.GetTrackingControllerCallsign()) : IsApModeS(ControllerMyself().GetCallsign())));
}

bool CCAMS::HasValidSquawk(const EuroScopePlugIn::CFlightPlan& FlightPlan)
Expand Down

0 comments on commit 615306a

Please sign in to comment.