Completed partial refactor.

This commit is contained in:
2023-10-08 20:26:37 -04:00
parent df54840a88
commit a0d2ccb5ab
2 changed files with 10 additions and 11 deletions
+7 -4
View File
@@ -20,9 +20,7 @@ public class Terrain {
// Class variables // Class variables
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>(); public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>();
Zone zone;
public int template;
public short[][] terrain_pixel_data; public short[][] terrain_pixel_data;
public Vector2f terrain_size = new Vector2f(); public Vector2f terrain_size = new Vector2f();
@@ -32,7 +30,12 @@ public class Terrain {
public static int heightMapsCreated; 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 =
} }
+3 -7
View File
@@ -97,7 +97,7 @@ public class Zone extends AbstractGameObject {
this.min_blend = rs.getFloat("min_blend"); this.min_blend = rs.getFloat("min_blend");
this.max_blend = rs.getFloat("max_blend"); this.max_blend = rs.getFloat("max_blend");
this.sea_level_type = rs.getString("sea_level_type"); 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_type = rs.getString("terrain_type");
this.terrain_max_y = rs.getFloat("terrain_max_y"); this.terrain_max_y = rs.getFloat("terrain_max_y");
this.terrain_image = rs.getInt("terrain_image"); this.terrain_image = rs.getInt("terrain_image");
@@ -272,16 +272,15 @@ public class Zone extends AbstractGameObject {
} }
public ArrayList<Zone> getNodes() { public ArrayList<Zone> getNodes() {
if (this.nodes == null) { if (this.nodes == null) {
this.nodes = DbManager.ZoneQueries.GET_MAP_NODES(super.getObjectUUID()); this.nodes = DbManager.ZoneQueries.GET_MAP_NODES(super.getObjectUUID());
//Add reverse lookup for child->parent //Add reverse lookup for child->parent
if (this.nodes != null) if (this.nodes != null)
for (Zone zone : this.nodes) { for (Zone zone : this.nodes)
zone.setParent(this); zone.setParent(this);
}
} }
return nodes; return nodes;
} }
@@ -312,7 +311,6 @@ public class Zone extends AbstractGameObject {
return this.parent.equals(ZoneManager.getSeaFloor()); return this.parent.equals(ZoneManager.getSeaFloor());
} }
public void setHash() { public void setHash() {
this.hash = DataWarehouse.hasher.encrypt(this.getObjectUUID()); this.hash = DataWarehouse.hasher.encrypt(this.getObjectUUID());
@@ -322,6 +320,4 @@ public class Zone extends AbstractGameObject {
DataWarehouse.writeHash(Enum.DataRecordType.ZONE, this.getObjectUUID()); DataWarehouse.writeHash(Enum.DataRecordType.ZONE, this.getObjectUUID());
} }
// Return heightmap for this Zone.
} }