1
0
Fork 0

#561: keep magnetic heading within limits when mag-variation is negative

Thanks to Hyde!
This commit is contained in:
ThorstenB 2012-01-04 00:00:10 +01:00
parent 476a96dacf
commit 23cdb0d302

View file

@ -367,7 +367,8 @@ getHeadingMag ()
{ {
double magheading; double magheading;
magheading = fgGetDouble("/orientation/heading-deg") - getMagVar(); magheading = fgGetDouble("/orientation/heading-deg") - getMagVar();
if (magheading < 0) magheading += 360; if (magheading <= 0) magheading += 360;
else if (magheading > 360) magheading -= 360;
return magheading; return magheading;
} }
@ -379,7 +380,8 @@ getTrackMag ()
{ {
double magtrack; double magtrack;
magtrack = fgGetDouble("/orientation/track-deg") - getMagVar(); magtrack = fgGetDouble("/orientation/track-deg") - getMagVar();
if (magtrack < 0) magtrack += 360; if (magtrack <= 0) magtrack += 360;
else if (magtrack > 360) magtrack -= 360;
return magtrack; return magtrack;
} }