use the correct return values

This commit is contained in:
Sven Czarnian
2021-12-16 16:00:44 +01:00
parent 1570b9c7f1
commit 7238d6b92e

View File

@@ -233,7 +233,7 @@ int Inbound::matchToPredictedPath(const EuroScopePlugIn::CFlightPlanPositionPred
trackmiles = 0_m;
if (1 >= predictions.GetPointsNumber())
return 0;
return 1;
std::vector<Length> distances;
distances.reserve(static_cast<std::size_t>(predictions.GetPointsNumber()) - 1);
@@ -250,7 +250,7 @@ int Inbound::matchToPredictedPath(const EuroScopePlugIn::CFlightPlanPositionPred
/* calculate the theoretical maximum distance (assuming one minute steps) and validate the distance */
const auto& maxDistance = groundspeed * 1_min;
if (gsl::at(distances, idx) > maxDistance)
return 0;
return predictions.GetPointsNumber();
if (idx + 1 < static_cast<std::size_t>(predictions.GetPointsNumber()) && 0 != idx) {
const auto bearingCurrent = position.bearingTo(GeoCoordinate(__convert(predictions.GetPosition(idx))));