]> git.mxchange.org Git - flightgear.git/commitdiff
Fix for refueling and radar calculations.
authordurk <durk>
Fri, 15 Jun 2007 20:52:32 +0000 (20:52 +0000)
committerdurk <durk>
Fri, 15 Jun 2007 20:52:32 +0000 (20:52 +0000)
src/AIModel/AIAircraft.cxx
src/AIModel/AIManager.cxx
src/AIModel/AITanker.cxx
src/AIModel/AITanker.hxx

index ea0637bf235e4d4c1b4f02ebefe496aa8dacfa2d..8f16feee54776de22fb4a003836ddda1b2ef4f17 100644 (file)
@@ -192,6 +192,7 @@ void FGAIAircraft::Run(double dt) {
     updateAltitudes();
     updateVerticalSpeed();
     matchPitchAngle();
+    UpdateRadar(manager);
 }
 
 
@@ -254,9 +255,6 @@ void FGAIAircraft::SetFlightPlan(FGAIFlightPlan *f) {
 
 void FGAIAircraft::ProcessFlightPlan( double dt, time_t now ) {
 
-    //if (! fpExecutable(now))
-    //      return;
-
     // the one behind you
     FGAIFlightPlan::waypoint* prev = 0;
     // the one ahead
@@ -277,7 +275,8 @@ void FGAIAircraft::ProcessFlightPlan( double dt, time_t now ) {
         handleFirstWaypoint();
         return;
     }                            // end of initialization
-
+    if (! fpExecutable(now))
+          return;
     dt_count = 0;
 
     if (! leadPointReached(curr)) {
@@ -643,9 +642,9 @@ bool FGAIAircraft::leadPointReached(FGAIFlightPlan::waypoint* curr) {
     // experimental: Use fabs, because speed can be negative (I hope) during push_back.
 
     if (lead_dist < fabs(2*speed)) {
-        //don't skip over the waypoint
-        lead_dist = fabs(2*speed);
-        //cerr << "Extending lead distance to " << lead_dist << endl;
+      //don't skip over the waypoint
+      lead_dist = fabs(2*speed);
+      //cerr << "Extending lead distance to " << lead_dist << endl;
     }
 
     //prev_dist_to_go = dist_to_go;
@@ -686,8 +685,10 @@ bool FGAIAircraft::handleAirportEndPoints(FGAIFlightPlan::waypoint* prev, time_t
 
     // This waypoint marks the fact that the aircraft has passed the initial taxi
     // departure waypoint, so it can release the parking.
-    if (prev->name == "park2")
+    if (prev->name == "park2") {
         dep->getDynamics()->releaseParking(fp->getGate());
+       cerr << trafficRef->getCallSign() << "releasing parking " << fp->getGate() << endl;
+    }
 
     // This is the last taxi waypoint, and marks the the end of the flight plan
     // so, the schedule should update and wait for the next departure time.
@@ -697,7 +698,7 @@ bool FGAIAircraft::handleAirportEndPoints(FGAIFlightPlan::waypoint* prev, time_t
         if (nextDeparture < (now+1200)) {
             nextDeparture = now + 1200;
         }
-        fp->setTime(nextDeparture);
+        fp->setTime(nextDeparture); // should be "next departure"
     }
 
     return true;
index 6d9a3cf5ac7f1771cc73d5a461422ab699271255..19a6c76b1f9ecb4d85817dea778a663b64423d81 100644 (file)
@@ -264,9 +264,9 @@ FGAIManager::processScenario( const string &filename ) {
         std::string type = scEntry->getStringValue("type", "aircraft");
 
          if (type == "tanker") { // refueling scenarios
-           FGAITanker* aircraft = new FGAITanker;
-            aircraft->readFromScenario(scEntry);
-            attach(aircraft);        
+           FGAITanker* tanker = new FGAITanker;
+            tanker->readFromScenario(scEntry);
+            attach(tanker);
     } else if (type == "aircraft") {
             FGAIAircraft* aircraft = new FGAIAircraft;
             aircraft->readFromScenario(scEntry);
index d184b2b97ec3abf49225d0a5176ccc6db555edd0..6582e00e1c870d0069cba64d4edc27020872b513 100644 (file)
@@ -70,3 +70,10 @@ void FGAITanker::Run(double dt) {
         contact = false;
     }
 }
+
+
+void FGAITanker::update(double dt) {
+     FGAIAircraft::update(dt);
+     Run(dt);
+     Transform();
+}
\ No newline at end of file
index 9114dc20072e285ad0bbbf64ecc86ec3a2f14218..dcb812e44a49cdb939559d9aa8622f82b911d1fd 100644 (file)
@@ -31,7 +31,7 @@
  * is to have a clean generic AIAircraft class without any special functionality. In your
  * scenario specification use 'tanker' as the scenario type to use this class.
  * 
- * @author Thomas Förster <t.foerster@biologie.hu-berlin.de>
+ * @author Thomas Fster <t.foerster@biologie.hu-berlin.de>
 */
 
 class FGAITanker : public FGAIAircraft {
@@ -52,7 +52,7 @@ private:
     bool contact;                // set if this tanker is within fuelling range
 
     virtual void Run(double dt);
-
+    virtual void update (double dt);
 };
 
 #endif