Browse Source

Clamp value at pole

combat-2
MagicBot 1 year ago
parent
commit
5db8c47aa8
  1. 12
      src/engine/InterestManagement/HeightMap.java

12
src/engine/InterestManagement/HeightMap.java

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

Loading…
Cancel
Save