From: James Turner Date: Thu, 25 Dec 2014 18:52:13 +0000 (+0300) Subject: Fix distance-along-path computation X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5c659b3970e9a4542519e0d528016c08f7ecb6c1;p=flightgear.git Fix distance-along-path computation (Thanks to Hyde Yamakawa for pointing this one) --- 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 }