]> git.mxchange.org Git - flightgear.git/commitdiff
RNAV: use runway departure end for previous wpt.
authorJames Turner <zakalawe@mac.com>
Sat, 10 Jan 2015 19:35:11 +0000 (19:35 +0000)
committerJames Turner <zakalawe@mac.com>
Sat, 10 Jan 2015 19:35:11 +0000 (19:35 +0000)
Should fix leg computation following a runway waypt.

src/Instrumentation/gps.cxx

index 3b3fa726bbda34951d3b3eb3a489a6605998dc77..9b808627e3f3597ebfa7acfa5b704c15426ed248 100644 (file)
@@ -462,13 +462,20 @@ SGGeod GPS::previousLegWaypointPosition(bool& isValid)
        FlightPlan::Leg* leg = _route->previousLeg();
        if (leg){
                Waypt* waypt = leg->waypoint();
-               if(waypt){
-                       isValid = true;
+               if (waypt) {
+            isValid = true;
+            // ensure computations use runway end, not threshold
+            if (waypt->type() == "runway") {
+                RunwayWaypt* rwpt = static_cast<RunwayWaypt*>(waypt);
+                return rwpt->runway()->end();
+            }
+
                        return waypt->position();
                }
        }
+
        isValid = false;
-  return SGGeod();
+    return SGGeod();
 }
 ///////////////////////////////////////////////////////////////////////////