]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/runwayprefs.cxx
Fix for refueling and radar calculations.
[flightgear.git] / src / Airports / runwayprefs.cxx
index e829c8dd057dea344a22f21f721b108a989f9c8e..90767d728a2407d5256b09b62a18ff323035efb8 100644 (file)
@@ -231,10 +231,10 @@ void RunwayGroup::setActive(const string &aptId,
          // preference, however, we don't want to stop right there, because we also
          // don't want to randomly swap runway preferences, unless there is a need to. 
          //
-
+         validSelection = true;
          for (int j = 0; j < activeRwys; j++)
            {
-             validSelection = true;
+            
              name = rwyList[j].getRwyList(i);
              //cerr << "Name of Runway: " << name << endl;
              if (globals->get_runways()->search( aptId, 
@@ -255,12 +255,12 @@ void RunwayGroup::setActive(const string &aptId,
                  //cerr << "Crosswnd : " << crossWind << endl;
                  if ((tailWind > maxTail) || (crossWind > maxCross))
                    {
-                     //cerr << "Invalid : ";
+                     //cerr << "Invalid : " << endl;
                      validSelection = false;
                   }
                  else 
                    {
-                     //cerr << "Valid   : ";
+                     //cerr << "Valid   : " << endl;;
                  }
                }else {
                SG_LOG( SG_GENERAL, SG_INFO, "Failed to find runway " << name << " at " << aptId );
@@ -269,18 +269,18 @@ void RunwayGroup::setActive(const string &aptId,
            }
          if (validSelection) 
            {
-             //cerr << "Valid   : ";
+             //cerr << "Valid selection  : " << i << endl;;
              foundValidSelection = true;
              for (stringVecIterator it = currentlyActive->begin(); 
                   it != currentlyActive->end(); it++)
                {
                  if ((*it) == name)
                    match++;
-                 if (match >= bestMatch) {
-                   bestMatch = match;
-                   bestChoice = i;
-                 }
                }
+             if (match >= bestMatch) {
+               bestMatch = match;
+               bestChoice = i;
+             }
            } 
          //cerr << "Preference " << i << " bestMatch " << bestMatch << " choice " << bestChoice << endl;
        }
@@ -566,11 +566,9 @@ void  FGRunwayPreference::pi (const char * target, const char * data) {
 }
 
 void  FGRunwayPreference::warning (const char * message, int line, int column) {
-  cout << "Warning: " << message << " (" << line << ',' << column << ')'   
-       << endl;
+  SG_LOG(SG_IO, SG_WARN, "Warning: " << message << " (" << line << ',' << column << ')');
 }
 
 void  FGRunwayPreference::error (const char * message, int line, int column) {
-  cout << "Error: " << message << " (" << line << ',' << column << ')'
-       << endl;
+  SG_LOG(SG_IO, SG_ALERT, "Error: " << message << " (" << line << ',' << column << ')');
 }