From 7644c74df90c1e8cc1239d9d1b5b8db15f23ee5e Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 22 Dec 2015 15:15:09 -0600 Subject: [PATCH] Better Traffic performance data warnings. --- src/AIModel/AIAircraft.cxx | 5 ++++- src/AIModel/performancedb.cxx | 2 -- src/Traffic/TrafficMgr.cxx | 13 +++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index c3c1e36af..c6276a102 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -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(); if (perfDB) { _performance = perfDB->getDefaultPerformance(); + } else { + SG_LOG(SG_AI, SG_ALERT, "no performance DB found"); } dt = 0; diff --git a/src/AIModel/performancedb.cxx b/src/AIModel/performancedb.cxx index 464cd5d5a..3a8ce5459 100644 --- a/src/AIModel/performancedb.cxx +++ b/src/AIModel/performancedb.cxx @@ -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()) { diff --git a/src/Traffic/TrafficMgr.cxx b/src/Traffic/TrafficMgr.cxx index 4fc8bd38b..62a2de4e3 100644 --- a/src/Traffic/TrafficMgr.cxx +++ b/src/Traffic/TrafficMgr.cxx @@ -67,6 +67,8 @@ #include #include #include +#include + #include #include
#include
@@ -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(); // 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; } -- 2.39.5