From a4fde6c4d8399a72040f2384a0abaf1aed3418e6 Mon Sep 17 00:00:00 2001
From: mfranz <mfranz>
Date: Thu, 10 May 2007 14:28:17 +0000
Subject: [PATCH] - don't abort just because of an unexpected "repeat period"!
 Complain and   recover instead - it was apparently planned to run the updated
 loop only every 1000th   frame, but the counter isn't reset, so it runs every
 frame - use SG_LOG instead of cerr - don't add redundant slashes in
 SGPath::append()

---
 src/Traffic/SchedFlight.cxx | 5 +++--
 src/Traffic/TrafficMgr.cxx  | 9 +++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/Traffic/SchedFlight.cxx b/src/Traffic/SchedFlight.cxx
index a66915a1e..52661664d 100644
--- a/src/Traffic/SchedFlight.cxx
+++ b/src/Traffic/SchedFlight.cxx
@@ -127,8 +127,9 @@ FGScheduledFlight::FGScheduledFlight(const string& cs,
     }
   else
     {
-      cerr << "Unknown repeat period" << endl;
-      exit(1);
+      repeatPeriod = 365*24*60*60;
+      SG_LOG( SG_GENERAL, SG_ALERT, "Unknown repeat period in flight plan "
+                                    "of flight '" << cs << "': " << rep );
     }
 
   // What we still need to do is preprocess the departure and
diff --git a/src/Traffic/TrafficMgr.cxx b/src/Traffic/TrafficMgr.cxx
index dd42d52f3..70e8af644 100644
--- a/src/Traffic/TrafficMgr.cxx
+++ b/src/Traffic/TrafficMgr.cxx
@@ -123,10 +123,10 @@ void FGTrafficManager::init()
    * until we have some AI models with traffic in the base package
    */ 
   SGPath path = aircraftDir;
-  path.append("/Traffic/fgtraffic.xml");
+  path.append("Traffic/fgtraffic.xml");
   readXML(path.str(),*this);
 
-  aircraftDir.append("AI/Aircraft/");
+  aircraftDir.append("AI/Aircraft");
   if (aircraftDir.exists())
     {
       if((d = ulOpenDir(aircraftDir.c_str())) == NULL)
@@ -166,7 +166,7 @@ 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() ");
   if (runCount < 1000)
@@ -174,6 +174,7 @@ void FGTrafficManager::update(double something)
       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 +189,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() ");