diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index 3439663a..d3361472 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -327,15 +327,15 @@ public class HeightMap { // Clamp values. - if (zoneLoc.x >= this.fullExtentsX) - Logger.error("Outside of zone"); - - if (zoneLoc.y >= this.fullExtentsY) - Logger.error("Outside of zone"); - float xBucket = zoneLoc.x / this.bucketWidthX; float yBucket = zoneLoc.y / this.bucketWidthY; + if (xBucket >= this.bucketCountX) + xBucket = this.bucketCountX - 1; + + if (yBucket >= this.bucketCountY) + yBucket = this.bucketCountY - 1; + return new Vector2f(xBucket, yBucket); }