From a0d2ccb5abc4809cb8cdd7fd22d7cc02748cb0dc Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 8 Oct 2023 20:26:37 -0400 Subject: [PATCH] Completed partial refactor. --- src/engine/InterestManagement/Terrain.java | 11 +++++++---- src/engine/objects/Zone.java | 10 +++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index 328ff890..463f8fe8 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -20,9 +20,7 @@ public class Terrain { // Class variables public static final HashMap _heightmap_pixel_cache = new HashMap<>(); - - - public int template; + Zone zone; public short[][] terrain_pixel_data; public Vector2f terrain_size = new Vector2f(); @@ -32,7 +30,12 @@ public class Terrain { public static int heightMapsCreated; - public Terrain() { + public Terrain(Zone zone) { + + this.terrain_size.x = zone.major_radius; + this.terrain_size.y = zone.minor_radius; + + this.terrain_pixel_data = } diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index 40212443..d32e0338 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -97,7 +97,7 @@ public class Zone extends AbstractGameObject { this.min_blend = rs.getFloat("min_blend"); this.max_blend = rs.getFloat("max_blend"); this.sea_level_type = rs.getString("sea_level_type"); - this.sea_level = rs.getFloat("sea_level"); + this.sea_level_offset = rs.getFloat("sea_level"); this.terrain_type = rs.getString("terrain_type"); this.terrain_max_y = rs.getFloat("terrain_max_y"); this.terrain_image = rs.getInt("terrain_image"); @@ -272,16 +272,15 @@ public class Zone extends AbstractGameObject { } public ArrayList getNodes() { + if (this.nodes == null) { this.nodes = DbManager.ZoneQueries.GET_MAP_NODES(super.getObjectUUID()); //Add reverse lookup for child->parent if (this.nodes != null) - for (Zone zone : this.nodes) { + for (Zone zone : this.nodes) zone.setParent(this); - } } - return nodes; } @@ -312,7 +311,6 @@ public class Zone extends AbstractGameObject { return this.parent.equals(ZoneManager.getSeaFloor()); } - public void setHash() { this.hash = DataWarehouse.hasher.encrypt(this.getObjectUUID()); @@ -322,6 +320,4 @@ public class Zone extends AbstractGameObject { DataWarehouse.writeHash(Enum.DataRecordType.ZONE, this.getObjectUUID()); } - // Return heightmap for this Zone. - }