From 5c659b3970e9a4542519e0d528016c08f7ecb6c1 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 25 Dec 2014 21:52:13 +0300 Subject: [PATCH] Fix distance-along-path computation (Thanks to Hyde Yamakawa for pointing this one) --- src/Navaids/FlightPlan.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Navaids/FlightPlan.cxx b/src/Navaids/FlightPlan.cxx index b58df9431..83edf5c78 100644 --- a/src/Navaids/FlightPlan.cxx +++ b/src/Navaids/FlightPlan.cxx @@ -1193,15 +1193,16 @@ void FlightPlan::rebuildLegData() for (unsigned int l=0; l<_legs.size(); ++l) { _legs[l]->_courseDeg = path.trackForIndex(l); _legs[l]->_pathDistance = path.distanceForIndex(l) * SG_METER_TO_NM; + + totalDistanceIncludingMissed += _legs[l]->_pathDistance; + // distance along path includes our own leg distance _legs[l]->_distanceAlongPath = totalDistanceIncludingMissed; - // omit misseed-approach waypoints from total distance calculation + // omit missed-approach waypoints from total distance calculation if (!_legs[l]->waypoint()->flag(WPT_MISS)) { _totalDistance += _legs[l]->_pathDistance; } - - totalDistanceIncludingMissed += _legs[l]->_pathDistance; - } // of legs iteration +} // of legs iteration }