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,7 +2344,9 @@ 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->bFlags & b->bFlags) & MODES_ACFLAGS_SQUAWK_VALID) {
// ...check for Mode-A == Mode-S Squawk matches
if (a->modeA == b->modeA) { // If a 'real' Mode-S ICAO exists using this Mode-A Squawk if (a->modeA == b->modeA) { // If a 'real' Mode-S ICAO exists using this Mode-A Squawk
b->modeAcount = a->messages; b->modeAcount = a->messages;
b->modeACflags |= MODEAC_MSG_MODEA_HIT; b->modeACflags |= MODEAC_MSG_MODEA_HIT;
@ -2354,8 +2356,11 @@ void interactiveUpdateAircraftModeA(struct aircraft *a) {
|| (a->modeACflags & MODEAC_MSG_MODEA_ONLY)) ) // Allow Mode-A only matches if this Mode-A is invalid Mode-C || (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 {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->bFlags & b->bFlags) & MODES_ACFLAGS_ALTITUDE_VALID) {
// ... check for Mode-C == Mode-S Altitude matches
if ( (a->modeC == b->modeC ) // If a 'real' Mode-S ICAO exists at this Mode-C Altitude if ( (a->modeC == b->modeC ) // If a 'real' Mode-S ICAO exists at this Mode-C Altitude
|| (a->modeC == b->modeC + 1) // or this Mode-C - 100 ft || (a->modeC == b->modeC + 1) // or this Mode-C - 100 ft
|| (a->modeC + 1 == b->modeC ) ) { // or this Mode-C + 100 ft || (a->modeC + 1 == b->modeC ) ) { // or this Mode-C + 100 ft
@ -2367,6 +2372,7 @@ void interactiveUpdateAircraftModeA(struct aircraft *a) {
{a->modeACflags |= (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEC_OLD);} // flag this ModeA/C probably belongs to a known Mode S {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;
} }
} }