]> git.mxchange.org Git - flightgear.git/blobdiff - src/Traffic/Schedule.cxx
Move viewer-related sources to separate folder.
[flightgear.git] / src / Traffic / Schedule.cxx
index 4314d0237b5abed9679d36ca7fd0148c14d800fe..5f1dc9f31e6c8f5ea893ffd3cf9bac01b8c4becc 100644 (file)
@@ -196,7 +196,7 @@ bool FGAISchedule::update(time_t now, const SGVec3d& userCart)
   time_t 
     totalTimeEnroute, 
     elapsedTimeEnroute,
-    remainingTimeEnroute, 
+    //remainingTimeEnroute,
     deptime = 0;
   if (!valid) {
     return false;
@@ -228,7 +228,7 @@ bool FGAISchedule::update(time_t now, const SGVec3d& userCart)
     
   if (AIManagerRef) {
     // Check if this aircraft has been released. 
-    FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("Traffic Manager");
+    FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("traffic-manager");
     if (tmgr->isReleased(AIManagerRef)) {
       AIManagerRef = 0;
     } else {
@@ -259,7 +259,7 @@ bool FGAISchedule::update(time_t now, const SGVec3d& userCart)
     totalTimeEnroute = flight->getArrivalTime() - flight->getDepartureTime();
     if (flight->getDepartureTime() < now) {
       elapsedTimeEnroute   = now - flight->getDepartureTime();
-      remainingTimeEnroute = totalTimeEnroute - elapsedTimeEnroute;
+      //remainingTimeEnroute = totalTimeEnroute - elapsedTimeEnroute;
       double x = elapsedTimeEnroute / (double) totalTimeEnroute;
       
     // current pos is based on great-circle course between departure/arrival,
@@ -275,7 +275,7 @@ bool FGAISchedule::update(time_t now, const SGVec3d& userCart)
       speed = ((distanceM - coveredDistance) * SG_METER_TO_NM) / 3600.0;
     } else {
     // not departed yet
-      remainingTimeEnroute = totalTimeEnroute;
+      //remainingTimeEnroute = totalTimeEnroute;
       elapsedTimeEnroute = 0;
       position = dep->geod();
       SG_LOG (SG_GENERAL, SG_BULK, "Traffic Manager:      Flight is pending, departure in "
@@ -283,7 +283,7 @@ bool FGAISchedule::update(time_t now, const SGVec3d& userCart)
     }
   } else {
     // departure / arrival coincident
-    remainingTimeEnroute = totalTimeEnroute = 0.0;
+    //remainingTimeEnroute = totalTimeEnroute = 0.0;
     elapsedTimeEnroute = 0;
     position = dep->geod();
   }
@@ -334,7 +334,7 @@ bool FGAISchedule::createAIAircraft(FGScheduledFlight* flight, double speedKnots
   aircraft->setLatitude(position.getLatitudeDeg());
   aircraft->setLongitude(position.getLongitudeDeg());
   aircraft->setAltitude(flight->getCruiseAlt()*100); // convert from FL to feet
-  aircraft->setSpeed(speedKnots);
+  aircraft->setSpeed(0);
   aircraft->setBank(0);
       
   courseToDest = SGGeodesy::courseDeg(position, arr->geod());
@@ -347,7 +347,7 @@ bool FGAISchedule::createAIAircraft(FGScheduledFlight* flight, double speedKnots
                                             airline);
   if (fp->isValidPlan()) {
         aircraft->SetFlightPlan(fp);
-        FGAIManager* aimgr = (FGAIManager *) globals-> get_subsystem("ai_model");
+        FGAIManager* aimgr = (FGAIManager *) globals-> get_subsystem("ai-model");
         aimgr->attach(aircraft);
         AIManagerRef = aircraft->getID();
         return true;
@@ -389,15 +389,10 @@ void FGAISchedule::scheduleFlights(time_t now)
     if (!flight) {
       break;
     }
-    //if (startingPort.empty()) {
-    //    startingPort = flight->getDepartureAirport()->getId();
-    //}
     currentDestination = flight->getArrivalAirport()->getId();
     //cerr << "Current destination " <<  currentDestination << endl;
     if (!initialized) {
         string departurePort = flight->getDepartureAirport()->getId();
-       //cerr << "Scheduled " << registration <<  " " << score << " for Flight " 
-       //     << flight-> getCallSign() << " from " << departurePort << " to " << currentDestination << endl;
         if (userPort == departurePort) {
             lastRun = 1;
             hits++;
@@ -465,7 +460,7 @@ FGScheduledFlight* FGAISchedule::findAvailableFlight (const string &currentDesti
 {
     time_t now = time(NULL) + fgGetLong("/sim/time/warp");
 
-    FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("Traffic Manager");
+    FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("traffic-manager");
     FGScheduledFlightVecIterator fltBegin, fltEnd;
     fltBegin = tmgr->getFirstFlight(req);
     fltEnd   = tmgr->getLastFlight(req);