]> git.mxchange.org Git - flightgear.git/commitdiff
Fix distance-along-path computation
authorJames Turner <zakalawe@mac.com>
Thu, 25 Dec 2014 18:52:13 +0000 (21:52 +0300)
committerJames Turner <zakalawe@mac.com>
Thu, 25 Dec 2014 18:52:13 +0000 (21:52 +0300)
(Thanks to Hyde Yamakawa for pointing this one)

src/Navaids/FlightPlan.cxx

index b58df94313be2688f3b44f5fcce30730538c521b..83edf5c78aded2b7b566f55fbaf73da7d0692ff0 100644 (file)
@@ -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
   
 }