]> git.mxchange.org Git - simgear.git/commitdiff
Whups, fixed a simple bug so you can now fly across the lon = +/-180
authorcurt <curt>
Tue, 25 May 1999 11:54:21 +0000 (11:54 +0000)
committercurt <curt>
Tue, 25 May 1999 11:54:21 +0000 (11:54 +0000)
boundary without any problems.

Lib/Bucket/newbucket.cxx

index ff3c7b4221e74f8cdc588c24b402f846633889eb..bb6f8bb9a2645013be3580c23df884abf479db59 100644 (file)
@@ -97,7 +97,14 @@ FGBucket fgBucketOffset( double dlon, double dlat, int dx, int dy ) {
     double span = bucket_span( clat );
 
     // walk dx units in the lon direction
-    result.set_bucket( dlon + dx * span, clat );
+    double tmp = dlon + dx * span;
+    while ( tmp < -180.0 ) {
+       tmp += 360.0;
+    }
+    while ( tmp >= 180.0 ) {
+       tmp -= 360.0;
+    }
+    result.set_bucket( tmp, clat );
 
     return result;
 }