]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/groundnetwork.cxx
Merge branch 'csaba/nan'
[flightgear.git] / src / Airports / groundnetwork.cxx
index 529fc5952152d457e5ba334f42435c609dcce616..054741ac4374de577c796f2bf0570bf24710605d 100644 (file)
@@ -267,11 +267,11 @@ void FGGroundNetwork::init()
       {
        if ((*j)->getEnd()->getIndex() == (*i)->getStart()->getIndex())
          {
-           int start1 = (*i)->getStart()->getIndex();
-           int end1   = (*i)->getEnd()  ->getIndex();
-           int start2 = (*j)->getStart()->getIndex();
-           int end2   = (*j)->getEnd()->getIndex();
-           int oppIndex = (*j)->getIndex();
+//         int start1 = (*i)->getStart()->getIndex();
+//         int end1   = (*i)->getEnd()  ->getIndex();
+//         int start2 = (*j)->getStart()->getIndex();
+//         int end2   = (*j)->getEnd()->getIndex();
+//         int oppIndex = (*j)->getIndex();
            //cerr << "Opposite of  " << (*i)->getIndex() << " (" << start1 << "," << end1 << ") "
            //   << "happens to be " << oppIndex      << " (" << start2 << "," << end2 << ") " << endl;
            (*i)->setOpposite(*j);
@@ -316,7 +316,7 @@ int FGGroundNetwork::findNearestNode(double lat, double lon)
   return findNearestNode(SGGeod::fromDeg(lon, lat));
 }
 
-FGTaxiNode *FGGroundNetwork::findNode(int idx)
+FGTaxiNode *FGGroundNetwork::findNode(unsigned idx)
 { /*
     for (FGTaxiNodeVectorIterator 
     itr = nodes.begin();
@@ -332,7 +332,7 @@ FGTaxiNode *FGGroundNetwork::findNode(int idx)
     return 0;
 }
 
-FGTaxiSegment *FGGroundNetwork::findSegment(int idx)
+FGTaxiSegment *FGGroundNetwork::findSegment(unsigned idx)
 {/*
   for (FGTaxiSegmentVectorIterator 
         itr = segments.begin();
@@ -554,7 +554,7 @@ void FGGroundNetwork::update(int id, double lat, double lon, double heading, dou
    instruction. See below for the hold position instruction.
 
    Note that there currently still is one flaw in the logic that needs to be addressed. 
-   can be situations where one aircraft is in front of the current aircraft, on a separate
+   There can be situations where one aircraft is in front of the current aircraft, on a separate
    route, but really close after an intersection coming off the current route. This
    aircraft is still close enough to block the current aircraft. This situation is currently
    not addressed yet, but should be.
@@ -606,7 +606,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
       
         SGGeod other(SGGeod::fromDegM(i->getLongitude(),
           i->getLatitude(), i->getAltitude()));
-        SGGeodesy::inverse(other, curr, course, az2, dist);
+        SGGeodesy::inverse(curr, other, course, az2, dist);
         bearing = fabs(heading-course);
            if (bearing > 180)
              bearing = 360-bearing;
@@ -625,8 +625,9 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
            {
              //cerr << "Comparing " << current->getId() << " and " << i->getId() << endl;
              SGGeod other(SGGeod::fromDegM(i->getLongitude(),
-          i->getLatitude(), i->getAltitude()));
-        SGGeodesy::inverse(other, curr, course, az2, dist);
+                                            i->getLatitude(), 
+                                            i->getAltitude()));
+        SGGeodesy::inverse(curr, other, course, az2, dist);
         bearing = fabs(heading-course);
              if (bearing > 180)
           bearing = 360-bearing;
@@ -642,12 +643,12 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
       // Finally, check UserPosition
       double userLatitude  = fgGetDouble("/position/latitude-deg");
       double userLongitude = fgGetDouble("/position/longitude-deg");
-      SGGeod user(SGGeod::fromDeg(userLatitude,userLongitude));
-      SGGeodesy::inverse(user, curr, course, az2, dist);
-      
+      SGGeod user(SGGeod::fromDeg(userLongitude,userLatitude));
+      SGGeodesy::inverse(curr, user, course, az2, dist);
+
       bearing = fabs(heading-course);
       if (bearing > 180)
-       bearing = 360-bearing;
+      bearing = 360-bearing;
       if ((dist < mindist) && (bearing < 60.0))
        {
          mindist = dist;
@@ -655,13 +656,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
          minbearing = bearing;
          otherReasonToSlowDown = true;
        }
-      
-      //       if (closest == current) {
-      //         //SG_LOG(SG_GENERAL, SG_ALERT, "AI error: closest and current match");
-      //         //return;
-      //       }      
-      //cerr << "Distance : " << dist << " bearing : " << bearing << " heading : " << heading 
-      //   << " course : " << course << endl;
+
       current->clearSpeedAdjustment();
     
       if (current->checkPositionAndIntentions(*closest) || otherReasonToSlowDown)