]> git.mxchange.org Git - flightgear.git/commitdiff
James Turner:
authorehofman <ehofman>
Sun, 24 Aug 2008 09:04:24 +0000 (09:04 +0000)
committerehofman <ehofman>
Sun, 24 Aug 2008 09:04:24 +0000 (09:04 +0000)
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.

src/Airports/simple.cxx

index c550f4822627eba8ea535e03a5b8a08257ece8c1..7a5871fd76d6fae445182c14a8b7883abfdd9614 100644 (file)
@@ -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;