From 668e3ee70f7c82aadd9b4df12bceee785227c56d Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 18 Nov 2023 12:26:50 -0500 Subject: [PATCH] Clamp fix for new method --- src/engine/InterestManagement/Terrain.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index c1ae25b3..b8aa5e2e 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -60,7 +60,7 @@ public class Terrain { this.cell_count.y = this.image_size.y; this.cell_size.x = terrain_size.x / this.cell_count.x; - this.cell_size.y = terrain_size.y / this.cell_count.y; + this.cell_size.y = terrain_size.y / this.cell_count.x; // Bug mirrors exe // Blending configuration. These ratios are used to calculate // the blending area between child and parent terrains when @@ -164,8 +164,8 @@ public class Terrain { // Clamp values when standing directly on pole - terrain_cell.x = Math.max(0, Math.min(this.cell_count.x - 2, terrain_cell.x)); - terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 2, terrain_cell.y)); + terrain_cell.x = Math.max(0, Math.min(this.cell_count.x - 1, terrain_cell.x)); + terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 1, terrain_cell.y)); return terrain_cell; }