X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FTraffic%2FTrafficMgr.cxx;h=86be2196cb2e02e4da8b1a76152f65bda97089f3;hb=c1e29d09981dfcd47ff213069fbe8fd5c8ccaf0c;hp=dd42d52f381a56f16bad648f6f37cb7015cda618;hpb=e48409d13664500d2ae7bb69c4b37c3c79a21cf9;p=flightgear.git diff --git a/src/Traffic/TrafficMgr.cxx b/src/Traffic/TrafficMgr.cxx index dd42d52f3..86be2196c 100644 --- a/src/Traffic/TrafficMgr.cxx +++ b/src/Traffic/TrafficMgr.cxx @@ -123,10 +123,11 @@ void FGTrafficManager::init() * until we have some AI models with traffic in the base package */ SGPath path = aircraftDir; - path.append("/Traffic/fgtraffic.xml"); - readXML(path.str(),*this); + path.append("Traffic/fgtraffic.xml"); + if (path.exists()) + readXML(path.str(),*this); - aircraftDir.append("AI/Aircraft/"); + aircraftDir.append("AI/Aircraft"); if (aircraftDir.exists()) { if((d = ulOpenDir(aircraftDir.c_str())) == NULL) @@ -166,14 +167,18 @@ void FGTrafficManager::init() //cerr << "Done initializing schedules" << endl; } -void FGTrafficManager::update(double something) +void FGTrafficManager::update(double /*dt*/) { //SG_LOG( SG_GENERAL, SG_INFO, "Running TrafficManager::Update() "); + // Hack alert: Skip running for the first frames 1000 after + // initialization to allow proper initialization of wheather stuff + // and runway assignments if (runCount < 1000) { runCount++; return; } + //runCount = 0; time_t now = time(NULL) + fgGetLong("/sim/time/warp"); if (scheduledAircraft.size() == 0) { //SG_LOG( SG_GENERAL, SG_INFO, "Returned Running TrafficManager::Update() "); @@ -188,7 +193,7 @@ void FGTrafficManager::update(double something) { // after proper initialization, we shouldnt get here. // But let's make sure - cerr << "Failed to update aircraft schedule in traffic manager" << endl; + SG_LOG( SG_GENERAL, SG_ALERT, "Failed to update aircraft schedule in traffic manager"); } currAircraft++; //SG_LOG( SG_GENERAL, SG_INFO, "Done Running TrafficManager::Update() ");