]> git.mxchange.org Git - flightgear.git/commitdiff
Better Traffic performance data warnings.
authorJames Turner <zakalawe@mac.com>
Tue, 22 Dec 2015 21:15:09 +0000 (15:15 -0600)
committerJames Turner <zakalawe@mac.com>
Tue, 22 Dec 2015 21:15:27 +0000 (15:15 -0600)
src/AIModel/AIAircraft.cxx
src/AIModel/performancedb.cxx
src/Traffic/TrafficMgr.cxx

index c3c1e36af3178de7775b721a6806199d09ac93b3..c6276a102f444435df9b851cb34eef869488af7c 100644 (file)
@@ -56,7 +56,8 @@ using std::endl;
 FGAIAircraft::FGAIAircraft(FGAISchedule *ref) :
      /* HOT must be disabled for AI Aircraft,
       * otherwise traffic detection isn't working as expected.*/
-     FGAIBase(otAircraft, false) 
+    FGAIBase(otAircraft, false),
+    _performance(0)
 {
     trafficRef = ref;
     if (trafficRef) {
@@ -96,6 +97,8 @@ FGAIAircraft::FGAIAircraft(FGAISchedule *ref) :
     PerformanceDB* perfDB = globals->get_subsystem<PerformanceDB>();
     if (perfDB) {
         _performance = perfDB->getDefaultPerformance();
+    } else {
+        SG_LOG(SG_AI, SG_ALERT, "no performance DB found");
     }
 
     dt = 0;
index 464cd5d5a4036377aa7704c38df749ea705b8c58..3a8ce545969f7d08f0b43d171b8f92b9bf3635cb 100644 (file)
@@ -79,8 +79,6 @@ PerformanceData* PerformanceDB::getDataFor(const string& acType, const string& a
     if (it != _db.end()) {
         return it->second;
     }
-  
-    SG_LOG(SG_AI, SG_INFO, "no performance data for " << acType);
 
     it = _db.find(acClass);
     if (it == _db.end()) {
index 4fc8bd38b675bdfea092bf19cc308e403b7edb4f..62a2de4e33a329e5e2f8e4ea69ace4b81d7122df 100644 (file)
@@ -67,6 +67,8 @@
 #include <AIModel/AIAircraft.hxx>
 #include <AIModel/AIFlightPlan.hxx>
 #include <AIModel/AIBase.hxx>
+#include <AIModel/performancedb.hxx>
+
 #include <Airports/airport.hxx>
 #include <Main/fg_init.hxx>
 #include <Main/globals.hxx>
@@ -317,7 +319,9 @@ private:
         
         if (!FGAISchedule::validModelPath(mdl)) {
             missingModels.insert(mdl);
+#if defined(ENABLE_DEV_WARNINGS)
             SG_LOG(SG_AI, SG_WARN, "TrafficMgr: Missing model path:" << mdl);
+#endif
             requiredAircraft = homePort = "";
             return;
         }
@@ -578,10 +582,17 @@ void FGTrafficManager::finishInit()
     assert(doingInit);
     SG_LOG(SG_AI, SG_INFO, "finishing AI-Traffic init");
     loadHeuristics();
+
+    PerformanceDB* perfDB = globals->get_subsystem<PerformanceDB>();
     
     // Do sorting and scoring separately, to take advantage of the "homeport" variable
     BOOST_FOREACH(FGAISchedule* schedule, scheduledAircraft) {
         schedule->setScore();
+#if defined(ENABLE_DEV_WARNINGS)
+        if (!perfDB->havePerformanceDataForAircraftType(schedule->getAircraft())) {
+            SG_LOG(SG_AI, SG_WARN, "AI-Traffic: schedule aircraft missing performance data:" << schedule->getAircraft());
+        }
+#endif
     }
     
     sort(scheduledAircraft.begin(), scheduledAircraft.end(),
@@ -626,8 +637,10 @@ void FGTrafficManager::loadHeuristics()
               break;
             HeuristicMapIterator itr = heurMap.find(h.registration);
             if (itr != heurMap.end()) {
+#if defined(ENABLE_DEV_WARNINGS)
               SG_LOG(SG_AI, SG_WARN,"Traffic Manager Warning: found duplicate tailnumber " <<
                      h.registration << " for AI aircraft");
+#endif
             } else {
               heurMap[h.registration] = h;
             }