]> git.mxchange.org Git - flightgear.git/commitdiff
Bugfix: Shutdown the ATC manager when it runs out of waypoints.
authorDurk Talsma <durktals@gmail.com>
Sun, 1 Jan 2012 12:12:13 +0000 (13:12 +0100)
committerDurk Talsma <durktals@gmail.com>
Sun, 1 Jan 2012 12:12:13 +0000 (13:12 +0100)
src/ATC/atc_mgr.cxx

index 78328ee5e1d50c26e3177052d52de9525ce2386e..e64c549455f61b61d82fdfc153b4433f03f6926e 100644 (file)
@@ -188,21 +188,28 @@ void FGATCManager::update ( double time ) {
     FGAIFlightPlan *fp = ai_ac.GetFlightPlan();
         
     /* test code : find out how the routing develops */
-    /*if (fp) {
+    if (fp) {
         int size = fp->getNrOfWayPoints();
         //cerr << "Setting pos" << pos << " ";
         //cerr << "setting intentions " ;
-        cerr << "Size of waypoint cue " << size << " ";
-        for (int i = 0; i < size; i++) {
-            int val = fp->getRouteIndex(i);
-            cerr << fp->getWayPoint(i)->getName() << " ";
+        // This indicates that we have run out of waypoints: Im future versions, the
+        // user should be able to select a new route, but for now just shut down the
+        // system. 
+        if (size < 3) {
+            //cerr << "Shutting down the atc_mgr" << endl;
+            return;
+        }
+        //cerr << "Size of waypoint cue " << size << " ";
+        //for (int i = 0; i < size; i++) {
+        //    int val = fp->getRouteIndex(i);
+            //cerr << fp->getWayPoint(i)->getName() << " ";
             //if ((val) && (val != pos)) {
                 //intentions.push_back(val);
                 //cerr << "[done ] " << endl;
             //}
-        }
-        cerr << "[done ] " << endl;
-    }*/
+        //}
+        //cerr << "[done ] " << endl;
+    }
     if (fp) {
         //cerr << "Currently at leg : " << fp->getLeg() << endl;
     }