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);
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;
}