From: jmt Date: Sat, 13 Feb 2010 19:33:54 +0000 (+0000) Subject: Bugfix: ensure GPS WP1 Mag-bearing is normalised to [0..360] X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5ed73d063c83ad0a8f4ec81435bcfd03c212e940;p=flightgear.git Bugfix: ensure GPS WP1 Mag-bearing is normalised to [0..360] --- diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx index 2c6f36495..2f7455b83 100644 --- a/src/Instrumentation/gps.cxx +++ b/src/Instrumentation/gps.cxx @@ -1186,7 +1186,9 @@ double GPS::getWP1MagBearing() const return -9999.0; } - return _wp1TrueBearing - _magvar_node->getDoubleValue(); + double magBearing = _wp1TrueBearing - _magvar_node->getDoubleValue(); + SG_NORMALIZE_RANGE(magBearing, 0.0, 360.0); + return magBearing; } double GPS::getWP1CourseDeviation() const