From 682d78301e4276ebb26df38ae5ab9a696230ea9e Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 27 Sep 2012 09:27:48 +0100 Subject: [PATCH] #793 - invalid data on final FP leg. The Flight-plan leg data computation was omitting certain data for the final waypoint, which in turn made some of the route-manager data bogus when flying the final leg. Fill in some sensible values which we can compute. --- src/Navaids/FlightPlan.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Navaids/FlightPlan.cxx b/src/Navaids/FlightPlan.cxx index 5f0c84eab..fd7f7fb1d 100644 --- a/src/Navaids/FlightPlan.cxx +++ b/src/Navaids/FlightPlan.cxx @@ -1018,6 +1018,15 @@ void FlightPlan::rebuildLegData() _legs[l]->_distanceAlongPath = _totalDistance; _totalDistance += crsDist.second * SG_METER_TO_NM; } // of legs iteration + +// set some data on the final leg + if (lastLeg > 0) { + // keep the same course as the final leg, when passing the final + // waypoint + _legs[lastLeg]->_courseDeg = _legs[lastLeg - 1]->_courseDeg; + _legs[lastLeg]->_pathDistance = 0.0; + _legs[lastLeg]->_distanceAlongPath = _totalDistance; + } } void FlightPlan::lockDelegate()