From a68496d451b2b61d1857a4602da8c349b2ca0979 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 12 Nov 2023 14:34:41 -0500 Subject: [PATCH] Array size helpful if debugging --- src/engine/InterestManagement/Terrain.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index c6de9b38..e1963729 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -21,6 +21,8 @@ import static java.lang.Math.PI; public class Terrain { public static final HashMap _heightmap_pixel_cache = new HashMap<>(); public short[][] terrain_pixel_data; + + public Vector2f image_size = new Vector2f(); public Vector2f terrain_size = new Vector2f(); public Vector2f cell_size = new Vector2f(); public Vector2f cell_count = new Vector2f(); @@ -44,6 +46,7 @@ public class Terrain { // Load pixel data for this terrain from cache this.terrain_pixel_data = Terrain._heightmap_pixel_cache.get(heightmap); + this.image_size.set(this.terrain_pixel_data.length, this.terrain_pixel_data[0].length); if (terrain_pixel_data == null) Logger.error("Pixel map empty for zone: " + this.zone.getObjectUUID() + ":" + this.zone.zoneName); @@ -53,8 +56,8 @@ public class Terrain { this.terrain_size.x = this.zone.major_radius * 2; this.terrain_size.y = this.zone.minor_radius * 2; - this.cell_count.x = this.terrain_pixel_data.length - 1; - this.cell_count.y = this.terrain_pixel_data[0].length - 1; + this.cell_count.x = this.image_size.x - 1; + this.cell_count.y = this.image_size.y - 1; this.cell_size.x = terrain_size.x / this.cell_count.x; this.cell_size.y = terrain_size.y / this.cell_count.y;