+
+
+double FGAIFlightPlan::checkTrackLength(string wptName) {
+ // skip the first two waypoints: first one is behind, second one is partially done;
+ double trackDistance = 0;
+ wpt_vector_iterator wptvec = waypoints.begin();
+ wptvec++;
+ wptvec++;
+ while ((wptvec != waypoints.end()) && ((*wptvec)->name != wptName)) {
+ trackDistance += (*wptvec)->trackLength;
+ wptvec++;
+ }
+ if (wptvec == waypoints.end()) {
+ trackDistance = 0; // name not found
+ }
+ return trackDistance;
+}
\ No newline at end of file