Browse Source

Completed partial refactor.

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
a0d2ccb5ab
  1. 11
      src/engine/InterestManagement/Terrain.java
  2. 10
      src/engine/objects/Zone.java

11
src/engine/InterestManagement/Terrain.java

@ -20,9 +20,7 @@ public class Terrain { @@ -20,9 +20,7 @@ public class Terrain {
// Class variables
public static final HashMap<Integer, short[][]> _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 { @@ -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 =
}

10
src/engine/objects/Zone.java

@ -97,7 +97,7 @@ public class Zone extends AbstractGameObject { @@ -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 { @@ -272,16 +272,15 @@ public class Zone extends AbstractGameObject {
}
public ArrayList<Zone> 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 { @@ -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 { @@ -322,6 +320,4 @@ public class Zone extends AbstractGameObject {
DataWarehouse.writeHash(Enum.DataRecordType.ZONE, this.getObjectUUID());
}
// Return heightmap for this Zone.
}

Loading…
Cancel
Save