Update ModeA/C to ModeS

Update the ModeA/C to Mode S comparison routine to use bFlags.
This commit is contained in:
Malcolm Robb 2013-05-11 15:02:34 +01:00
parent 6427fcc1ee
commit d0469061ff

View file

@ -2344,27 +2344,33 @@ void interactiveUpdateAircraftModeA(struct aircraft *a) {
while(b) { while(b) {
if ((b->modeACflags & MODEAC_MSG_FLAG) == 0) {// skip any fudged ICAO records if ((b->modeACflags & MODEAC_MSG_FLAG) == 0) {// skip any fudged ICAO records
// First check for Mode-A <=> Mode-S Squawk matches // If both (a) and (b) have valid squawks...
if (a->modeA == b->modeA) { // If a 'real' Mode-S ICAO exists using this Mode-A Squawk if ((a->bFlags & b->bFlags) & MODES_ACFLAGS_SQUAWK_VALID) {
b->modeAcount = a->messages; // ...check for Mode-A == Mode-S Squawk matches
b->modeACflags |= MODEAC_MSG_MODEA_HIT; if (a->modeA == b->modeA) { // If a 'real' Mode-S ICAO exists using this Mode-A Squawk
a->modeACflags |= MODEAC_MSG_MODEA_HIT; b->modeAcount = a->messages;
if ( (b->modeAcount > 0) && b->modeACflags |= MODEAC_MSG_MODEA_HIT;
( (b->modeCcount > 1) a->modeACflags |= MODEAC_MSG_MODEA_HIT;
|| (a->modeACflags & MODEAC_MSG_MODEA_ONLY)) ) // Allow Mode-A only matches if this Mode-A is invalid Mode-C if ( (b->modeAcount > 0) &&
{a->modeACflags |= MODEAC_MSG_MODES_HIT;} // flag this ModeA/C probably belongs to a known Mode S ( (b->modeCcount > 1)
|| (a->modeACflags & MODEAC_MSG_MODEA_ONLY)) ) // Allow Mode-A only matches if this Mode-A is invalid Mode-C
{a->modeACflags |= MODEAC_MSG_MODES_HIT;} // flag this ModeA/C probably belongs to a known Mode S
}
} }
// Next check for Mode-C <=> Mode-S Altitude matches // If both (a) and (b) have valid altitudes...
if ( (a->modeC == b->modeC ) // If a 'real' Mode-S ICAO exists at this Mode-C Altitude if ((a->bFlags & b->bFlags) & MODES_ACFLAGS_ALTITUDE_VALID) {
|| (a->modeC == b->modeC + 1) // or this Mode-C - 100 ft // ... check for Mode-C == Mode-S Altitude matches
|| (a->modeC + 1 == b->modeC ) ) { // or this Mode-C + 100 ft if ( (a->modeC == b->modeC ) // If a 'real' Mode-S ICAO exists at this Mode-C Altitude
b->modeCcount = a->messages; || (a->modeC == b->modeC + 1) // or this Mode-C - 100 ft
b->modeACflags |= MODEAC_MSG_MODEC_HIT; || (a->modeC + 1 == b->modeC ) ) { // or this Mode-C + 100 ft
a->modeACflags |= MODEAC_MSG_MODEC_HIT; b->modeCcount = a->messages;
if ( (b->modeAcount > 0) && b->modeACflags |= MODEAC_MSG_MODEC_HIT;
(b->modeCcount > 1) ) a->modeACflags |= MODEAC_MSG_MODEC_HIT;
{a->modeACflags |= (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEC_OLD);} // flag this ModeA/C probably belongs to a known Mode S if ( (b->modeAcount > 0) &&
(b->modeCcount > 1) )
{a->modeACflags |= (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEC_OLD);} // flag this ModeA/C probably belongs to a known Mode S
}
} }
} }
b = b->next; b = b->next;