if (!deptime)
deptime = (*flights.begin())->getDepartureTime();
FGScheduledFlightVecIterator i = flights.begin();
- SG_LOG (SG_GENERAL, SG_DEBUG,"Processing registration " << registration << " with callsign " << (*i)->getCallSign());
+ SG_LOG (SG_GENERAL, SG_DEBUG,"Traffic Manager: Processing registration " << registration << " with callsign " << (*i)->getCallSign());
if (AIManagerRef)
{
// Check if this aircraft has been released.
// push it forward in time to the next scheduled departure.
if (((*i)->getDepartureTime() < now) && ((*i)->getArrivalTime() < now))
{
+ SG_LOG (SG_GENERAL, SG_DEBUG, "Traffic Manager: Flight is in the Past");
(*i)->update();
return true;
}
// Part of this flight is in the future.
if ((*i)->getArrivalTime() > now)
{
+
dep = (*i)->getDepartureAirport();
arr = (*i)->getArrivalAirport ();
if (!(dep && arr))
//cerr << "Time diff: " << now-i->getDepartureTime() << endl;
elapsedTimeEnroute = now - (*i)->getDepartureTime();
remainingTimeEnroute = (*i)->getArrivalTime() - now;
+ SG_LOG (SG_GENERAL, SG_DEBUG, "Traffic Manager: Flight is in progress.");
}
else
{
lon = dep->getLongitude();
elapsedTimeEnroute = 0;
remainingTimeEnroute = totalTimeEnroute;
+ SG_LOG (SG_GENERAL, SG_DEBUG, "Traffic Manager: Flight is pending.");
}
angle *= ( (double) elapsedTimeEnroute/ (double) totalTimeEnroute);
// then 500nm, create this flight. At jet speeds 500 nm is roughly
// one hour flight time, so that would be a good approximate point
// to start a more detailed simulation of this aircraft.
- //cerr << registration << " is currently enroute from "
- // << dep->_id << " to " << arr->_id << "distance : "
- // << distanceToUser*SG_METER_TO_NM << endl;
+ SG_LOG (SG_GENERAL, SG_DEBUG, "Traffic manager: " << registration << " is scheduled for a flight from "
+ << dep->getId() << " to " << arr->getId() << ". Current distance to user: "
+ << distanceToUser*SG_METER_TO_NM);
if ((distanceToUser*SG_METER_TO_NM) < TRAFFICTOAIDIST)
{
string flightPlanName = dep->getId() + string("-") + arr->getId() +
string(".xml");
+ SG_LOG (SG_GENERAL, SG_DEBUG, "Traffic manager: Creating AIModel");
//int alt;
//if ((i->getDepartureTime() < now))
//{
}
else if (element == string("aircraft"))
{
- //cerr << "Pushing back aircraft " << registration << endl;
- scheduledAircraft.push_back(new FGAISchedule(mdl,
+ int proportion = (int) (fgGetDouble("/sim/traffic-manager/proportion") * 100);
+ int randval = rand() & 100;
+ if (randval < proportion) {
+ scheduledAircraft.push_back(new FGAISchedule(mdl,
livery,
registration,
heavy,
// while(flights.begin() != flights.end()) {
// flights.pop_back();
// }
+ }
for (FGScheduledFlightVecIterator flt = flights.begin(); flt != flights.end(); flt++)
{
delete (*flt);