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();
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;

View 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);

View file

@ -70,3 +70,10 @@ void FGAITanker::Run(double dt) {
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
* 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 {
@ -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