Good news: I'm working on some automatic testing of the 'core' FG pieces, especially those I'm likely to break in my Navaids / airports / runways work
Bad news: I already broke something, in my runways refactoring. (But my tests caught it!)
Attached patch fixes it - it's (of course) the stupidest thing in the world. Incidentally, standardising this kind of code into some (inlined) header is becoming more and more of a priority for me - I've lost count of the number of times I've seen the 'clamp heading to 0..360.0' and 'reverse a heading and clamp it' idioms in the code. The KLN89 and MkVIII code have (of course) their own helpers for this.
static double normaliseBearing(double aBearing)
{
- while (aBearing < -180.0) {
+ while (aBearing < 0.0) {
aBearing += 360.0;
}
- while (aBearing > 180.0) {
- aBearing -= 180.0;
+ while (aBearing > 360.0) {
+ aBearing -= 360.0;
}
return aBearing;