]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIAircraft.cxx
Alex Perry :
[flightgear.git] / src / AIModel / AIAircraft.cxx
index 7a06ba24189a3024ea4b65653b268f3688b5f2cb..3c1d1e4fb6ef4fef1e29f36acd9100ddcac0dce4 100644 (file)
@@ -29,6 +29,7 @@
 #include <Main/viewer.hxx>
 #include <Scenery/scenery.hxx>
 #include <Scenery/tilemgr.hxx>
+#include <Airports/dynamics.hxx>
 
 #include <string>
 #include <math.h>
@@ -40,7 +41,7 @@
 #  include <ieeefp.h>
 #endif
 
-SG_USING_STD(string);
+using std::string;
 
 #include "AIAircraft.hxx"
 #include "performancedata.hxx"
@@ -144,7 +145,8 @@ void FGAIAircraft::setPerformance(const std::string& acclass) {
       FGAIAircraft::dt = dt;
 
      try {
-         updatePrimaryTargetValues(); // target hdg, alt, speed
+         if ( !updatePrimaryTargetValues() ) // target hdg, alt, speed
+             return;
      }
      catch (AI_OutOfSight) {
          return;
@@ -728,7 +730,7 @@ void FGAIAircraft::controlSpeed(FGAIFlightPlan::waypoint* curr, FGAIFlightPlan::
 /**
  * Update target values (heading, alt, speed) depending on flight plan or control properties
  */
-void FGAIAircraft::updatePrimaryTargetValues() {
+bool FGAIAircraft::updatePrimaryTargetValues() {
     if (fp)                      // AI object has a flightplan
     {
         //TODO make this a function of AIBase
@@ -757,7 +759,7 @@ void FGAIAircraft::updatePrimaryTargetValues() {
         }
         timeElapsed = now - fp->getStartTime();
         if (! fp->isActive(now)) { 
-            throw FP_Inactive();
+            return false;
         }
     } else {
         // no flight plan, update target heading, speed, and altitude
@@ -788,6 +790,7 @@ void FGAIAircraft::updatePrimaryTargetValues() {
 
         AccelTo( props->getDoubleValue("controls/flight/target-spd" ) );
     }
+    return true;
 }
 
 void FGAIAircraft::updatePosition() {