From: James Turner <zakalawe@mac.com>
Date: Sat, 19 Dec 2015 05:59:28 +0000 (-0800)
Subject: Quiet down Traffic error logging.
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0e71a9593b885017bfeb30ab2495cc1089733f26;p=flightgear.git

Quiet down Traffic error logging.
---

diff --git a/src/AIModel/AIFlightPlan.cxx b/src/AIModel/AIFlightPlan.cxx
index b295310c6..dbfd06ee9 100644
--- a/src/AIModel/AIFlightPlan.cxx
+++ b/src/AIModel/AIFlightPlan.cxx
@@ -210,7 +210,12 @@ void FGAIFlightPlan::createWaypoints(FGAIAircraft *ac,
    if (timeDiff >= 2000)
    leg = 5;
    */
-  SG_LOG(SG_AI, SG_INFO, "Route from " << dep->getId() << " to " << arr->getId() << ". Set leg to : " << leg << " " << ac->getTrafficRef()->getCallSign());
+
+    if( sglog().would_log(SG_AI,SG_BULK) ) {
+        SG_LOG(SG_AI, SG_BULK, "Route from " << dep->getId() << " to " << arr->getId() <<
+               ". Set leg to : " << leg << " " << ac->getTrafficRef()->getCallSign());
+    }
+    
   wpt_iterator = waypoints.begin();
   bool dist = 0;
   isValid = create(ac, dep, arr, leg, alt, speed, lat, lon,
diff --git a/src/AIModel/AIFlightPlanCreate.cxx b/src/AIModel/AIFlightPlanCreate.cxx
index 59d442260..ae369d57b 100644
--- a/src/AIModel/AIFlightPlanCreate.cxx
+++ b/src/AIModel/AIFlightPlanCreate.cxx
@@ -219,8 +219,7 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
     // If this function is called during initialization,
     // make sure we obtain a valid gate ID first
     // and place the model at the location of the gate.
-    if (firstFlight)
-    {
+    if (firstFlight && apt->getDynamics()->hasParkings()) {
       gate =  apt->getDynamics()->getAvailableParking(radius, fltType,
                                                         acType, airline);
       if (!gate.isValid()) {
diff --git a/src/AIModel/AIFlightPlanCreatePushBack.cxx b/src/AIModel/AIFlightPlanCreatePushBack.cxx
index 923596d04..9e11a724d 100644
--- a/src/AIModel/AIFlightPlanCreatePushBack.cxx
+++ b/src/AIModel/AIFlightPlanCreatePushBack.cxx
@@ -66,10 +66,16 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
   
   // establish the parking position / gate if required
     if (firstFlight) {
+        // if the airprot has no parking positions defined, don't log
+        // the warning below.
+        if (!dep->getDynamics()->hasParkings()) {
+            return false;
+        }
+
       gate = dep->getDynamics()->getAvailableParking(radius, fltType,
                                                        aircraftType, airline);
       if (!gate.isValid()) {
-        SG_LOG(SG_AI, SG_WARN, "Warning: Could not find parking for a " <<
+        SG_LOG(SG_AI, SG_WARN, "Could not find parking for a " <<
                aircraftType <<
                " of flight type " << fltType <<
                " of airline     " << airline <<
diff --git a/src/Airports/dynamics.cxx b/src/Airports/dynamics.cxx
index fae2add25..c90d91c35 100644
--- a/src/Airports/dynamics.cxx
+++ b/src/Airports/dynamics.cxx
@@ -208,6 +208,11 @@ FGParking* FGAirportDynamics::innerGetAvailableParking(double radius, const stri
     return NULL;
 }
 
+bool FGAirportDynamics::hasParkings() const
+{
+    return !groundNetwork->allParkings().empty();
+}
+
 ParkingAssignment FGAirportDynamics::getAvailableParking(double radius, const string & flType,
                                             const string & acType,
                                             const string & airline)
diff --git a/src/Airports/dynamics.hxx b/src/Airports/dynamics.hxx
index cef41fa48..4c7fbd625 100644
--- a/src/Airports/dynamics.hxx
+++ b/src/Airports/dynamics.hxx
@@ -133,7 +133,9 @@ public:
                           int action,
                           std::string& runway,
                           double heading );
-    
+
+    bool hasParkings() const;
+
     /**
      * retrieve an available parking by GateID, or -1 if no suitable
      * parking location could be found.