From 0643b21baac1404bd037e5af8ec3865820644e62 Mon Sep 17 00:00:00 2001 From: durk Date: Fri, 15 Jun 2007 20:52:32 +0000 Subject: [PATCH] Fix for refueling and radar calculations. --- src/AIModel/AIAircraft.cxx | 19 ++++++++++--------- src/AIModel/AIManager.cxx | 6 +++--- src/AIModel/AITanker.cxx | 7 +++++++ src/AIModel/AITanker.hxx | 4 ++-- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index ea0637bf2..8f16feee5 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -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; diff --git a/src/AIModel/AIManager.cxx b/src/AIModel/AIManager.cxx index 6d9a3cf5a..19a6c76b1 100644 --- a/src/AIModel/AIManager.cxx +++ b/src/AIModel/AIManager.cxx @@ -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); diff --git a/src/AIModel/AITanker.cxx b/src/AIModel/AITanker.cxx index d184b2b97..6582e00e1 100644 --- a/src/AIModel/AITanker.cxx +++ b/src/AIModel/AITanker.cxx @@ -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 diff --git a/src/AIModel/AITanker.hxx b/src/AIModel/AITanker.hxx index 9114dc200..dcb812e44 100644 --- a/src/AIModel/AITanker.hxx +++ b/src/AIModel/AITanker.hxx @@ -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 + * @author Thomas F�ster */ 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 -- 2.39.2