From 8ece4caf1c6a6ff513de7db376e7429f4ffd0f72 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 17 Sep 2023 12:23:06 -0400 Subject: [PATCH] value is halfExtent --- src/engine/Enum.java | 6 +++--- src/engine/InterestManagement/HeightMap.java | 4 ++-- src/engine/gameManager/ZoneManager.java | 2 +- src/engine/mobileAI/utilities/MovementUtilities.java | 2 +- .../client/handlers/ClaimGuildTreeMsgHandler.java | 2 +- .../net/client/handlers/PlaceAssetMsgHandler.java | 4 ++-- src/engine/objects/Building.java | 4 ++-- src/engine/objects/City.java | 6 +++--- src/engine/objects/Zone.java | 12 ++++++------ 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 125bc6f7..2510c2ac 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2310,10 +2310,10 @@ public class Enum { ZONE(875), PLACEMENT(876); - public final float extents; + public final float halfExtents; - CityBoundsType(float extents) { - this.extents = extents; + CityBoundsType(float halfExtents) { + this.halfExtents = halfExtents; } } diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index 76ce63b6..f7eb71fe 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -119,8 +119,8 @@ public class HeightMap { this.heightMapID = 999999; this.maxHeight = 5; // for real... - int halfExtentsX = (int) Enum.CityBoundsType.ZONE.extents; - int halfExtentsY = (int) Enum.CityBoundsType.ZONE.extents; + int halfExtentsX = (int) Enum.CityBoundsType.ZONE.halfExtents; + int halfExtentsY = (int) Enum.CityBoundsType.ZONE.halfExtents; this.zoneLoadID = 0; this.seaLevel = 0; diff --git a/src/engine/gameManager/ZoneManager.java b/src/engine/gameManager/ZoneManager.java index 8c50d995..8967dad8 100644 --- a/src/engine/gameManager/ZoneManager.java +++ b/src/engine/gameManager/ZoneManager.java @@ -411,7 +411,7 @@ public enum ZoneManager { treeBounds = Bounds.borrow(); - treeBounds.setBounds(new Vector2f(positionX, positionZ), new Vector2f(Enum.CityBoundsType.PLACEMENT.extents, Enum.CityBoundsType.PLACEMENT.extents), 0.0f); + treeBounds.setBounds(new Vector2f(positionX, positionZ), new Vector2f(Enum.CityBoundsType.PLACEMENT.halfExtents, Enum.CityBoundsType.PLACEMENT.halfExtents), 0.0f); zoneList = currentZone.getNodes(); diff --git a/src/engine/mobileAI/utilities/MovementUtilities.java b/src/engine/mobileAI/utilities/MovementUtilities.java index 6b322f35..63a6982b 100644 --- a/src/engine/mobileAI/utilities/MovementUtilities.java +++ b/src/engine/mobileAI/utilities/MovementUtilities.java @@ -51,7 +51,7 @@ public class MovementUtilities { //Guards recall distance = 814. if (tol != null) { - return !(agent.getLoc().distanceSquared2D(tol.getLoc()) > sqr(Enum.CityBoundsType.ZONE.extents)); + return !(agent.getLoc().distanceSquared2D(tol.getLoc()) > sqr(Enum.CityBoundsType.ZONE.halfExtents)); } } diff --git a/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java b/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java index dad056fd..23570e45 100644 --- a/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java +++ b/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java @@ -117,7 +117,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler { dispatch = Dispatch.borrow(sourcePlayer, gtsm); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); - CityZoneMsg czm = new CityZoneMsg(2, playerZone.getLoc().x, playerZone.getLoc().y, playerZone.getLoc().z, playerCity.getCityName(), playerZone, Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents); + CityZoneMsg czm = new CityZoneMsg(2, playerZone.getLoc().x, playerZone.getLoc().y, playerZone.getLoc().z, playerCity.getCityName(), playerZone, Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents); DispatchMessage.dispatchMsgToAll(czm); break; diff --git a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java index a3f2b30c..f20d216c 100644 --- a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java +++ b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java @@ -661,7 +661,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { if (!building.getBlueprint().isSiegeEquip()) continue; - if (!building.getLoc().isInsideCircle(serverCity.getLoc(), CityBoundsType.ZONE.extents)) + if (!building.getLoc().isInsideCircle(serverCity.getLoc(), CityBoundsType.ZONE.halfExtents)) continue; if (building.getGuild() == null) @@ -807,7 +807,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Update guild binds and tags //load the new city on the clients - CityZoneMsg czm = new CityZoneMsg(1, treeObject.getLoc().x, treeObject.getLoc().y, treeObject.getLoc().z, cityObject.getCityName(), zoneObject, Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents); + CityZoneMsg czm = new CityZoneMsg(1, treeObject.getLoc().x, treeObject.getLoc().y, treeObject.getLoc().z, cityObject.getCityName(), zoneObject, Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents); DispatchMessage.dispatchMsgToAll(czm); GuildManager.updateAllGuildBinds(playerNation, cityObject); diff --git a/src/engine/objects/Building.java b/src/engine/objects/Building.java index 4bcc1086..7f63ab41 100644 --- a/src/engine/objects/Building.java +++ b/src/engine/objects/Building.java @@ -446,14 +446,14 @@ public class Building extends AbstractWorldObject { if (this.getBlueprint() != null && this.getBlueprint().isSiegeEquip() && this.protectionState.equals(ProtectionState.PROTECTED)) { if (this.getGuild() != null) { if (this.getGuild().getOwnedCity() != null) { - if (this.getLoc().isInsideCircle(this.getGuild().getOwnedCity().getLoc(), CityBoundsType.ZONE.extents)) + if (this.getLoc().isInsideCircle(this.getGuild().getOwnedCity().getLoc(), CityBoundsType.ZONE.halfExtents)) return this.getGuild().getOwnedCity(); } else { Bane bane = Bane.getBaneByAttackerGuild(this.getGuild()); if (bane != null) { if (bane.getCity() != null) { - if (this.getLoc().isInsideCircle(bane.getCity().getLoc(), CityBoundsType.ZONE.extents)) + if (this.getLoc().isInsideCircle(bane.getCity().getLoc(), CityBoundsType.ZONE.halfExtents)) return bane.getCity(); } } diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index f163b498..39b70bd9 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -583,7 +583,7 @@ public class City extends AbstractWorldObject { Bounds cityBounds = Bounds.borrow(); cityBounds.setBounds(new Vector2f(this.location.x + 64, this.location.z + 64), // location x and z are offset by 64 from the center of the city. - new Vector2f(Enum.CityBoundsType.GRID.extents, Enum.CityBoundsType.GRID.extents), + new Vector2f(Enum.CityBoundsType.GRID.halfExtents, Enum.CityBoundsType.GRID.halfExtents), 0.0f); this.setBounds(cityBounds); @@ -869,7 +869,7 @@ public class City extends AbstractWorldObject { public boolean isLocationWithinSiegeBounds(Vector3fImmutable insideLoc) { - return insideLoc.isInsideCircle(this.getLoc(), CityBoundsType.ZONE.extents); + return insideLoc.isInsideCircle(this.getLoc(), CityBoundsType.ZONE.halfExtents); } @@ -934,7 +934,7 @@ public class City extends AbstractWorldObject { // Gather current list of players within the zone bounds - currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, CityBoundsType.ZONE.extents, MBServerStatics.MASK_PLAYER); + currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, CityBoundsType.ZONE.halfExtents, MBServerStatics.MASK_PLAYER); currentMemory = new HashSet<>(); for (AbstractWorldObject playerObject : currentPlayers) { diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index 3c9a790e..7c5cf7aa 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -116,8 +116,8 @@ public class Zone extends AbstractGameObject { if (zone.playerCityID > 0) { writer.put((byte) 1); // Player City - True - writer.putFloat(Enum.CityBoundsType.ZONE.extents); - writer.putFloat(Enum.CityBoundsType.ZONE.extents); + writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents); + writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents); } else writer.put((byte) 0); // Player City - False @@ -173,7 +173,7 @@ public class Zone extends AbstractGameObject { // Player cities are assigned default value if (this.loadNum == 0) { - bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents), 0.0f); + bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents), 0.0f); return; } @@ -184,7 +184,7 @@ public class Zone extends AbstractGameObject { if (zoneSize != null) this.bounds.setBounds(new Vector2f(this.absX, this.absZ), zoneSize, 0.0f); else - bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents), 0.0f); + bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents), 0.0f); HeightMap heightMap = this.getHeightMap(); @@ -197,8 +197,8 @@ public class Zone extends AbstractGameObject { this.minBlend = Bounds.borrow(); this.maxBlend = Bounds.borrow(); - this.minBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents).subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f); - this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents).subtract(heightMap.zone_maxBlend, heightMap.zone_maxBlend), 0.0f); + this.minBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents).subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f); + this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.halfExtents, Enum.CityBoundsType.ZONE.halfExtents).subtract(heightMap.zone_maxBlend, heightMap.zone_maxBlend), 0.0f); } }