]> git.mxchange.org Git - flightgear.git/commitdiff
- Add some DEBUG level log messages to help users in getting traffic files
authordurk <durk>
Thu, 8 May 2008 06:11:43 +0000 (06:11 +0000)
committerdurk <durk>
Thu, 8 May 2008 06:11:43 +0000 (06:11 +0000)
   to work.
 - Add the possibility to load only proportion of traffic in order to
   reduce some of the workload, in case of a slower computer.

src/Traffic/Schedule.cxx
src/Traffic/TrafficMgr.cxx

index ac2a305c4f2b5cc2817c7b3a628a753728b1264b..557e4496349b90c985fe1d96067af5e11294de3f 100644 (file)
@@ -231,7 +231,7 @@ bool FGAISchedule::update(time_t now)
   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. 
@@ -250,6 +250,7 @@ bool FGAISchedule::update(time_t now)
       // 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;
        }
@@ -263,6 +264,7 @@ bool FGAISchedule::update(time_t now)
       // Part of this flight is in the future.
       if ((*i)->getArrivalTime() > now)
        {
+          
          dep = (*i)->getDepartureAirport();
          arr = (*i)->getArrivalAirport  ();
          if (!(dep && arr))
@@ -288,6 +290,7 @@ bool FGAISchedule::update(time_t now)
              //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
            {
@@ -295,6 +298,7 @@ bool FGAISchedule::update(time_t now)
              lon = dep->getLongitude();
              elapsedTimeEnroute = 0;
              remainingTimeEnroute = totalTimeEnroute;
+              SG_LOG (SG_GENERAL, SG_DEBUG, "Traffic Manager:      Flight is pending.");
            }
                  
          angle *= ( (double) elapsedTimeEnroute/ (double) totalTimeEnroute);
@@ -350,13 +354,14 @@ bool FGAISchedule::update(time_t now)
          // 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))
              //{
index 82a97f2c3dee8b72a403f7f31effd5e8f616ac2b..70ce07800e51e07b33d8bf66049fd4048a68de60 100644 (file)
@@ -307,8 +307,10 @@ void  FGTrafficManager::endElement (const char * name) {
     }
   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,
@@ -323,6 +325,7 @@ void  FGTrafficManager::endElement (const char * name) {
      //  while(flights.begin() != flights.end()) {
 //     flights.pop_back();
 //       }
+      }
       for (FGScheduledFlightVecIterator flt = flights.begin(); flt != flights.end(); flt++)
     {
       delete (*flt);