]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIFlightPlan.cxx
Bertrand Coconnier:
[flightgear.git] / src / AIModel / AIFlightPlan.cxx
index d24a83127954320d50ec60a1bf66fbd87f0bd468..381f9e94498f0680d44eaab337aa4a08005edf04 100644 (file)
@@ -366,6 +366,26 @@ void FGAIFlightPlan::IncrementWaypoint(bool eraseWaypoints )
 
 }
 
+void FGAIFlightPlan::DecrementWaypoint(bool eraseWaypoints )
+{
+    if (eraseWaypoints)
+    {
+        if (wpt_iterator == waypoints.end())
+            wpt_iterator--;
+        else
+        {
+            delete *(waypoints.end());
+            waypoints.erase(waypoints.end());
+            wpt_iterator = waypoints.end();
+            wpt_iterator--;
+        }
+    }
+    else
+        wpt_iterator--;
+
+}
+
+
 // gives distance in feet from a position to a waypoint
 double FGAIFlightPlan::getDistanceToGo(double lat, double lon, waypoint* wp) const{
   return SGGeodesy::distanceM(SGGeod::fromDeg(lon, lat),