Browse Source

Audit of zone loc

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
e7571f3e83
  1. 14
      src/engine/InterestManagement/HeightMap.java

14
src/engine/InterestManagement/HeightMap.java

@ -325,16 +325,16 @@ public class HeightMap { @@ -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);
}

Loading…
Cancel
Save