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) {
PerformanceDB* perfDB = globals->get_subsystem<PerformanceDB>();
if (perfDB) {
_performance = perfDB->getDefaultPerformance();
+ } else {
+ SG_LOG(SG_AI, SG_ALERT, "no performance DB found");
}
dt = 0;
#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>
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;
}
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(),
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;
}