diff --git a/src/Navaids/airways.cxx b/src/Navaids/airways.cxx index ccb8a8fca..18e120de9 100644 --- a/src/Navaids/airways.cxx +++ b/src/Navaids/airways.cxx @@ -398,6 +398,21 @@ WayptRef Airway::findEnroute(const std::string &aIdent) const return {}; } +WayptRef Airway::findEnroute(const FGPositionedRef& nav) const +{ + loadWaypoints(); + auto it = std::find_if(_elements.begin(), _elements.end(), + [&nav](WayptRef w) + { + if (!w) return false; + return w->source() == nav; + }); + + if (it != _elements.end()) + return *it; + return {}; +} + void Airway::Network::addEdge(int aWay, const SGGeod& aStartPos, const std::string& aStartIdent, const SGGeod& aEndPos, const std::string& aEndIdent) diff --git a/src/Navaids/airways.hxx b/src/Navaids/airways.hxx index 5441dda03..ea4a5d7a4 100644 --- a/src/Navaids/airways.hxx +++ b/src/Navaids/airways.hxx @@ -90,6 +90,7 @@ public: bool containsNavaid(const FGPositionedRef& navaid) const; + WayptRef findEnroute(const FGPositionedRef& navaid) const; /**