From e7571f3e8312d751ec097742380a86680e268b83 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 7 Oct 2023 20:43:17 -0400 Subject: [PATCH] Audit of zone loc --- src/engine/InterestManagement/HeightMap.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index 03d3df1f..3439663a 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -325,16 +325,16 @@ public class HeightMap { public Vector2f getGridSquare(Vector2f zoneLoc) { - float xBucket = (zoneLoc.x / this.bucketWidthX); - float yBucket = (zoneLoc.y / this.bucketWidthY); + // Clamp values. - // Standing on the pole + if (zoneLoc.x >= this.fullExtentsX) + Logger.error("Outside of zone"); - if (xBucket == this.bucketCountX) - xBucket--; + if (zoneLoc.y >= this.fullExtentsY) + Logger.error("Outside of zone"); - if (yBucket == this.bucketCountY) - yBucket--; + float xBucket = zoneLoc.x / this.bucketWidthX; + float yBucket = zoneLoc.y / this.bucketWidthY; return new Vector2f(xBucket, yBucket); }