diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index d3361472..7c09c945 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -98,10 +98,10 @@ public class HeightMap { // Calculate the data we do not load from table bucketCountX = this.heightmapImage.getWidth() - 1; - this.bucketWidthX = this.fullExtentsX / bucketCountX; + this.bucketWidthX = this.fullExtentsX / (float) bucketCountX; bucketCountY = this.heightmapImage.getHeight() - 1; - this.bucketWidthY = this.fullExtentsY / bucketCountY; + this.bucketWidthY = this.fullExtentsY / (float) bucketCountY; // Generate pixel array from image data @@ -331,10 +331,10 @@ public class HeightMap { float yBucket = zoneLoc.y / this.bucketWidthY; if (xBucket >= this.bucketCountX) - xBucket = this.bucketCountX - 1; + xBucket = xBucket - 1; if (yBucket >= this.bucketCountY) - yBucket = this.bucketCountY - 1; + yBucket = xBucket - 1; return new Vector2f(xBucket, yBucket); }