On 3 Jan 2012, at 23:09, Flightgear-commitlogs wrote: > #561: keep magnetic heading within limits when mag-variation is negative > Thanks to Hyde! >
> double magheading; > magheading = fgGetDouble("/orientation/heading-deg") - getMagVar(); > - if (magheading < 0) magheading += 360; > + if (magheading <= 0) magheading += 360; > + else if (magheading > 360) magheading -= 360; > return magheading; > } Please use one of the two helpers for this - partly because they're more compact to write, but also because they're easier to search for when checking for such issues. Either: SG_NORMALIZE_RANGE(magheading, 0.0, 360.0); Or: return SGMiscd::normalizePeriodic(0.0, 360.0, magheader ); Regards, James ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel