From 94b863a835734d406a1ac77c1bccd6eb32807617 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 21 Mar 2023 03:20:57 -0400 Subject: [PATCH] Rework of ismacro and iscontinent. --- src/engine/gameManager/ZoneManager.java | 4 ++-- .../client/handlers/PlaceAssetMsgHandler.java | 2 +- src/engine/objects/Zone.java | 20 +++++++++++-------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/engine/gameManager/ZoneManager.java b/src/engine/gameManager/ZoneManager.java index 5ac8a055..c2008eb2 100644 --- a/src/engine/gameManager/ZoneManager.java +++ b/src/engine/gameManager/ZoneManager.java @@ -444,7 +444,7 @@ public enum ZoneManager { boolean validLocation = true; Bounds treeBounds; - if (currentZone.isContininent() == false) + if (currentZone.isContinent() == false) return false; @@ -456,7 +456,7 @@ public enum ZoneManager { for (Zone zone : zoneList) { - if (zone.isContininent()) + if (zone.isContinent()) continue; if (Bounds.collide(treeBounds, zone.getBounds(), 0.0f)) diff --git a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java index 9ea4bf12..f9d8ccc4 100644 --- a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java +++ b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java @@ -978,7 +978,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // All trees must be placed within a continent. - if (!serverZone.isContininent()) { + if (!serverZone.isContinent()) { PlaceAssetMsg.sendPlaceAssetError(origin, 69, ""); // Tree must be within a territory return false; diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index 10ca5136..20b0fa50 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -23,7 +23,6 @@ import org.pmw.tinylog.Logger; import java.sql.ResultSet; import java.sql.SQLException; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Collections; import java.util.Set; @@ -288,8 +287,7 @@ public class Zone extends AbstractGameObject { public boolean isMacroZone() { - // Player cities are not considered a macrozone - // although their parent is always a continent. + // Macro zones have icons. if (this.isPlayerCity == true) return false; @@ -297,7 +295,7 @@ public class Zone extends AbstractGameObject { if (this.parent == null) return false; - return (this.parent.isContininent() == true); + return !this.getIcon1().equals(""); } public boolean isNPCCity() { @@ -440,7 +438,7 @@ public class Zone extends AbstractGameObject { if (zone == this) continue; - if (zone.isContininent() && zone.getPlayerCityUUID() == 0) + if (zone.isContinent() && zone.getPlayerCityUUID() == 0) continue; if (zone.getPlayerCityUUID() != 0){ @@ -464,12 +462,18 @@ public class Zone extends AbstractGameObject { return RuinedZone; } - public boolean isContininent() { + public boolean isContinent() { - if (this.parent == null) + if (this.equals(ZoneManager.getSeaFloor())) + return false; + + if (this.getNodes().isEmpty()) return false; - return this.parent.equals(ZoneManager.getSeaFloor()); + if (this.getNodes().get(0).isMacroZone()) + return true; + + return false; } /**