X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Froute%2Froute.hxx;h=6c5c5c876d8901cb334738a8e007c94e18b0dfcc;hb=7bdb530440d1dadc991f305edb1b70ec85f27451;hp=5307acf4707b894a8649044b5bdacc8cc998e0fc;hpb=03a7d72a62eb3f2a15242146b7b43ac54ab1fa44;p=simgear.git diff --git a/simgear/route/route.hxx b/simgear/route/route.hxx index 5307acf4..6c5c5c87 100644 --- a/simgear/route/route.hxx +++ b/simgear/route/route.hxx @@ -52,7 +52,7 @@ private: route_list route; int current_wp; - void update_distance(int index); + void update_distance_and_track(int index); public: @@ -102,6 +102,22 @@ public: return SGWayPoint( 0.0, 0.0, 0.0, SGWayPoint::WGS84, "invalid" ); } } + + inline SGWayPoint get_previous() const { + if ( (current_wp > 0) && (current_wp < (int)route.size()) ) { + return route[current_wp - 1]; + } else { + return SGWayPoint( 0.0, 0.0, 0.0, SGWayPoint::WGS84, "invalid" ); + } + } + + inline SGWayPoint get_next() const { + if ( (current_wp + 1) < (int)route.size() ) { + return route[current_wp+1]; + } else { + return SGWayPoint( 0.0, 0.0, 0.0, SGWayPoint::WGS84, "invalid" ); + } + } /** * Set the current waypoint