1
0
Fork 0

Better Traffic performance data warnings.

This commit is contained in:
James Turner 2015-12-22 15:15:09 -06:00
parent 7a69b9beff
commit 7644c74df9
3 changed files with 17 additions and 3 deletions

View file

@ -56,7 +56,8 @@ using std::endl;
FGAIAircraft::FGAIAircraft(FGAISchedule *ref) : FGAIAircraft::FGAIAircraft(FGAISchedule *ref) :
/* HOT must be disabled for AI Aircraft, /* HOT must be disabled for AI Aircraft,
* otherwise traffic detection isn't working as expected.*/ * otherwise traffic detection isn't working as expected.*/
FGAIBase(otAircraft, false) FGAIBase(otAircraft, false),
_performance(0)
{ {
trafficRef = ref; trafficRef = ref;
if (trafficRef) { if (trafficRef) {
@ -96,6 +97,8 @@ FGAIAircraft::FGAIAircraft(FGAISchedule *ref) :
PerformanceDB* perfDB = globals->get_subsystem<PerformanceDB>(); PerformanceDB* perfDB = globals->get_subsystem<PerformanceDB>();
if (perfDB) { if (perfDB) {
_performance = perfDB->getDefaultPerformance(); _performance = perfDB->getDefaultPerformance();
} else {
SG_LOG(SG_AI, SG_ALERT, "no performance DB found");
} }
dt = 0; dt = 0;

View file

@ -79,8 +79,6 @@ PerformanceData* PerformanceDB::getDataFor(const string& acType, const string& a
if (it != _db.end()) { if (it != _db.end()) {
return it->second; return it->second;
} }
SG_LOG(SG_AI, SG_INFO, "no performance data for " << acType);
it = _db.find(acClass); it = _db.find(acClass);
if (it == _db.end()) { if (it == _db.end()) {

View file

@ -67,6 +67,8 @@
#include <AIModel/AIAircraft.hxx> #include <AIModel/AIAircraft.hxx>
#include <AIModel/AIFlightPlan.hxx> #include <AIModel/AIFlightPlan.hxx>
#include <AIModel/AIBase.hxx> #include <AIModel/AIBase.hxx>
#include <AIModel/performancedb.hxx>
#include <Airports/airport.hxx> #include <Airports/airport.hxx>
#include <Main/fg_init.hxx> #include <Main/fg_init.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
@ -317,7 +319,9 @@ private:
if (!FGAISchedule::validModelPath(mdl)) { if (!FGAISchedule::validModelPath(mdl)) {
missingModels.insert(mdl); missingModels.insert(mdl);
#if defined(ENABLE_DEV_WARNINGS)
SG_LOG(SG_AI, SG_WARN, "TrafficMgr: Missing model path:" << mdl); SG_LOG(SG_AI, SG_WARN, "TrafficMgr: Missing model path:" << mdl);
#endif
requiredAircraft = homePort = ""; requiredAircraft = homePort = "";
return; return;
} }
@ -578,10 +582,17 @@ void FGTrafficManager::finishInit()
assert(doingInit); assert(doingInit);
SG_LOG(SG_AI, SG_INFO, "finishing AI-Traffic init"); SG_LOG(SG_AI, SG_INFO, "finishing AI-Traffic init");
loadHeuristics(); loadHeuristics();
PerformanceDB* perfDB = globals->get_subsystem<PerformanceDB>();
// Do sorting and scoring separately, to take advantage of the "homeport" variable // Do sorting and scoring separately, to take advantage of the "homeport" variable
BOOST_FOREACH(FGAISchedule* schedule, scheduledAircraft) { BOOST_FOREACH(FGAISchedule* schedule, scheduledAircraft) {
schedule->setScore(); 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(), sort(scheduledAircraft.begin(), scheduledAircraft.end(),
@ -626,8 +637,10 @@ void FGTrafficManager::loadHeuristics()
break; break;
HeuristicMapIterator itr = heurMap.find(h.registration); HeuristicMapIterator itr = heurMap.find(h.registration);
if (itr != heurMap.end()) { if (itr != heurMap.end()) {
#if defined(ENABLE_DEV_WARNINGS)
SG_LOG(SG_AI, SG_WARN,"Traffic Manager Warning: found duplicate tailnumber " << SG_LOG(SG_AI, SG_WARN,"Traffic Manager Warning: found duplicate tailnumber " <<
h.registration << " for AI aircraft"); h.registration << " for AI aircraft");
#endif
} else { } else {
heurMap[h.registration] = h; heurMap[h.registration] = h;
} }