Enforce max-range on mlat results (but still skip the speed check)

Fixes #97
This commit is contained in:
Oliver Jowett 2016-02-05 15:41:42 +00:00
parent 356cda2917
commit e101351b6e

View file

@ -252,10 +252,6 @@ static int doGlobalCPR(struct aircraft *a, struct modesMessage *mm, uint64_t now
return result;
}
// for mlat results, accept it unquestioningly
if (mm->bFlags & MODES_ACFLAGS_FROM_MLAT)
return result;
// check max range
if (Modes.maxRange > 0 && (Modes.bUserFlags & MODES_USER_LATLON_VALID)) {
double range = greatcircle(Modes.fUserLat, Modes.fUserLon, *lat, *lon);
@ -270,6 +266,10 @@ static int doGlobalCPR(struct aircraft *a, struct modesMessage *mm, uint64_t now
}
}
// for mlat results, skip the speed check
if (mm->bFlags & MODES_ACFLAGS_FROM_MLAT)
return result;
// check speed limit
if ((a->bFlags & MODES_ACFLAGS_LATLON_VALID) && a->pos_nuc >= *nuc && !speed_check(a, mm, *lat, *lon, now, surface)) {
Modes.stats_current.cpr_global_speed_checks++;