]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/procedure.cxx
Prepare and implement reinit methods for instruments
[flightgear.git] / src / Navaids / procedure.cxx
index bff774b4d360d12eaeb3890d33a2302b113d7de0..bb53a642929c8852d96f92ae861d1b4c268708d5 100644 (file)
@@ -93,21 +93,23 @@ void Approach::addTransition(Transition* aTrans)
 
 bool Approach::route(WayptRef aIAF, WayptVec& aWps)
 {
-  WptTransitionMap::iterator it;
-  bool haveTrans = false;
-  for (it = _transitions.begin(); it != _transitions.end(); ++it) {
-    Transition* t= it->second;
-    if (t->enroute()->matches(aIAF)) {
-      t->route(aWps);
-      haveTrans = true;
-      break;
+  if (aIAF.valid()) {
+    WptTransitionMap::iterator it;
+    bool haveTrans = false;
+    for (it = _transitions.begin(); it != _transitions.end(); ++it) {
+      Transition* t= it->second;
+      if (t->enroute()->matches(aIAF)) {
+        t->route(aWps);
+        haveTrans = true;
+        break;
+      }
+    } // of transitions iteration
+    
+    if (!haveTrans) {
+      SG_LOG(SG_GENERAL, SG_INFO, "approach " << ident() << " has no transition " <<
+        "for IAF: " << aIAF->ident());
+      return false;
     }
-  } // of transitions iteration
-  
-  if (!haveTrans) {
-    SG_LOG(SG_GENERAL, SG_INFO, "approach " << ident() << " has no transition " <<
-      "for IAF: " << aIAF->ident());
-    return false;
   }
   
   return routeFromVectors(aWps);
@@ -116,7 +118,9 @@ bool Approach::route(WayptRef aIAF, WayptVec& aWps)
 bool Approach::routeFromVectors(WayptVec& aWps)
 {
   aWps.insert(aWps.end(), _primary.begin(), _primary.end());
-  aWps.push_back(new RunwayWaypt(_runway, NULL));
+  RunwayWaypt* rwy = new RunwayWaypt(_runway, NULL);
+  rwy->setFlag(WPT_APPROACH);
+  aWps.push_back(rwy);
   aWps.insert(aWps.end(), _missed.begin(), _missed.end());
   return true;
 }