From: ehofman Date: Sun, 24 Aug 2008 09:04:24 +0000 (+0000) Subject: James Turner: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bd832fe32d07fab570fa7b5a01071b32a822f6e0;p=flightgear.git James Turner: 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. --- diff --git a/src/Airports/simple.cxx b/src/Airports/simple.cxx index c550f4822..7a5871fd7 100644 --- a/src/Airports/simple.cxx +++ b/src/Airports/simple.cxx @@ -168,12 +168,12 @@ FGAirport::getIteratorForRunwayIdent(const string& aIdent, bool& aReversed) cons 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;