From cc2a78b70b1f4d6075490f6b48d4084a9f4f4005 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 10 Jan 2015 19:35:11 +0000 Subject: [PATCH] RNAV: use runway departure end for previous wpt. Should fix leg computation following a runway waypt. --- src/Instrumentation/gps.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx index 3b3fa726b..9b808627e 100644 --- a/src/Instrumentation/gps.cxx +++ b/src/Instrumentation/gps.cxx @@ -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(waypt); + return rwpt->runway()->end(); + } + return waypt->position(); } } + isValid = false; - return SGGeod(); + return SGGeod(); } ///////////////////////////////////////////////////////////////////////////