]> git.mxchange.org Git - flightgear.git/blobdiff - src/Traffic/Schedule.cxx
Bugfix - untie property.
[flightgear.git] / src / Traffic / Schedule.cxx
index 8b193550b5b5858936a33965b95ed0eb4cc91364..3b8e7636db1946dca5d873df945a2236272323ff 100644 (file)
@@ -364,10 +364,12 @@ void FGAISchedule::scheduleFlights()
     currentDestination = flight->getArrivalAirport()->getId();
     if (!initialized) {
         string departurePort = flight->getDepartureAirport()->getId();
+       //cerr << "Scheduled " << registration <<  " " << score << " for Flight " 
+       //     << flight-> getCallSign() << " from " << departurePort << " to " << currentDestination << endl;
         if (fgGetString("/sim/presets/airport-id") == departurePort) {
             hits++;
         }
-        runCount++;
+        //runCount++;
         initialized = true;
     }
   
@@ -497,6 +499,20 @@ double FGAISchedule::getSpeed()
   return speed;
 }
 
+void FGAISchedule::setScore   () 
+{ 
+    if (runCount) {
+        score = ((double) hits / (double) runCount);
+    } else {
+        if (homePort == fgGetString("/sim/presets/airport-id")) {
+            score = 0.1;
+        } else {
+            score = 0.0;
+        }
+    }
+    runCount++;
+}
+
 bool compareSchedules(FGAISchedule*a, FGAISchedule*b)
 { 
   return (*a) < (*b);