]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/Turbulence.cpp
latest updates from JSBSim
[flightgear.git] / src / FDM / YASim / Turbulence.cpp
index da9741f7e1dd0132ab654cc0d5a25241dbf09842..4a618368098f69889b156339615fb65d79051e55 100644 (file)
@@ -138,8 +138,8 @@ void Turbulence::getTurbulence(double* loc, float alt, float* up,
     double b = (loc[1] + _off[1]) + _timeOff;
     a -= _sz * Math::floor(a * (1.0/_sz));
     b -= _sz * Math::floor(b * (1.0/_sz));
-    int x = (int)Math::floor(a);
-    int y = (int)Math::floor(b);
+    int x = ((int)Math::floor(a))&(_sz-1);
+    int y = ((int)Math::floor(b))&(_sz-1);
 
     // Convert to fractional interpolation factors
     a -= x;