1
0
Fork 0

Fix for refueling and radar calculations.

This commit is contained in:
durk 2007-06-15 20:52:32 +00:00
parent 864fd40ee9
commit 0643b21baa
4 changed files with 22 additions and 14 deletions

View file

@ -192,6 +192,7 @@ void FGAIAircraft::Run(double dt) {
updateAltitudes(); updateAltitudes();
updateVerticalSpeed(); updateVerticalSpeed();
matchPitchAngle(); matchPitchAngle();
UpdateRadar(manager);
} }
@ -254,9 +255,6 @@ void FGAIAircraft::SetFlightPlan(FGAIFlightPlan *f) {
void FGAIAircraft::ProcessFlightPlan( double dt, time_t now ) { void FGAIAircraft::ProcessFlightPlan( double dt, time_t now ) {
//if (! fpExecutable(now))
// return;
// the one behind you // the one behind you
FGAIFlightPlan::waypoint* prev = 0; FGAIFlightPlan::waypoint* prev = 0;
// the one ahead // the one ahead
@ -277,7 +275,8 @@ void FGAIAircraft::ProcessFlightPlan( double dt, time_t now ) {
handleFirstWaypoint(); handleFirstWaypoint();
return; return;
} // end of initialization } // end of initialization
if (! fpExecutable(now))
return;
dt_count = 0; dt_count = 0;
if (! leadPointReached(curr)) { 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. // experimental: Use fabs, because speed can be negative (I hope) during push_back.
if (lead_dist < fabs(2*speed)) { if (lead_dist < fabs(2*speed)) {
//don't skip over the waypoint //don't skip over the waypoint
lead_dist = fabs(2*speed); lead_dist = fabs(2*speed);
//cerr << "Extending lead distance to " << lead_dist << endl; //cerr << "Extending lead distance to " << lead_dist << endl;
} }
//prev_dist_to_go = dist_to_go; //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 // This waypoint marks the fact that the aircraft has passed the initial taxi
// departure waypoint, so it can release the parking. // departure waypoint, so it can release the parking.
if (prev->name == "park2") if (prev->name == "park2") {
dep->getDynamics()->releaseParking(fp->getGate()); 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 // 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. // 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)) { if (nextDeparture < (now+1200)) {
nextDeparture = now + 1200; nextDeparture = now + 1200;
} }
fp->setTime(nextDeparture); fp->setTime(nextDeparture); // should be "next departure"
} }
return true; return true;

View file

@ -264,9 +264,9 @@ FGAIManager::processScenario( const string &filename ) {
std::string type = scEntry->getStringValue("type", "aircraft"); std::string type = scEntry->getStringValue("type", "aircraft");
if (type == "tanker") { // refueling scenarios if (type == "tanker") { // refueling scenarios
FGAITanker* aircraft = new FGAITanker; FGAITanker* tanker = new FGAITanker;
aircraft->readFromScenario(scEntry); tanker->readFromScenario(scEntry);
attach(aircraft); attach(tanker);
} else if (type == "aircraft") { } else if (type == "aircraft") {
FGAIAircraft* aircraft = new FGAIAircraft; FGAIAircraft* aircraft = new FGAIAircraft;
aircraft->readFromScenario(scEntry); aircraft->readFromScenario(scEntry);

View file

@ -70,3 +70,10 @@ void FGAITanker::Run(double dt) {
contact = false; contact = false;
} }
} }
void FGAITanker::update(double dt) {
FGAIAircraft::update(dt);
Run(dt);
Transform();
}

View file

@ -31,7 +31,7 @@
* is to have a clean generic AIAircraft class without any special functionality. In your * 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. * scenario specification use 'tanker' as the scenario type to use this class.
* *
* @author Thomas Förster <t.foerster@biologie.hu-berlin.de> * @author Thomas F<EFBFBD>ster <t.foerster@biologie.hu-berlin.de>
*/ */
class FGAITanker : public FGAIAircraft { class FGAITanker : public FGAIAircraft {
@ -52,7 +52,7 @@ private:
bool contact; // set if this tanker is within fuelling range bool contact; // set if this tanker is within fuelling range
virtual void Run(double dt); virtual void Run(double dt);
virtual void update (double dt);
}; };
#endif #endif