From: ehofman Date: Tue, 1 Jul 2003 08:19:41 +0000 (+0000) Subject: Fix a problem where the compass goes negative by the variation when close to 360... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9d10d88f8f8c4f1180dd98b0324488a5ce1b152d;p=flightgear.git Fix a problem where the compass goes negative by the variation when close to 360 degrees --- diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index 18345fc9f..770ca620e 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -378,7 +378,10 @@ getMagDip () static double getHeadingMag () { - return current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES - getMagVar(); + double magheading; + magheading = current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES - getMagVar(); + if (magheading < 0) magheading += 360; + return magheading; }