#561: keep magnetic heading within limits when mag-variation is negative
Thanks to Hyde!
This commit is contained in:
parent
476a96dacf
commit
23cdb0d302
1 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue