From bf9fdae58ba2ae4a57d72661d7e474babe16f86a Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 20 Sep 2023 14:31:48 -0400 Subject: [PATCH] Method moved to manager. --- src/engine/InterestManagement/HeightMap.java | 8 -------- src/engine/gameManager/ZoneManager.java | 8 ++++++++ src/engine/net/client/handlers/PlaceAssetMsgHandler.java | 5 ++--- src/engine/objects/Bane.java | 3 +-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index dab19d2d..06813a46 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -351,14 +351,6 @@ public class HeightMap { } - public static boolean isLocUnderwater(Vector3fImmutable currentLoc) { - - float localAltitude = HeightMap.getWorldHeight(currentLoc); - Zone zone = ZoneManager.findSmallestZone(currentLoc); - - return localAltitude < zone.getSeaLevel(); - } - private static void generatePixelData(HeightMap heightMap) { Color color; diff --git a/src/engine/gameManager/ZoneManager.java b/src/engine/gameManager/ZoneManager.java index 8967dad8..8da4ee9e 100644 --- a/src/engine/gameManager/ZoneManager.java +++ b/src/engine/gameManager/ZoneManager.java @@ -481,4 +481,12 @@ public enum ZoneManager { return worldAlttitude; } + + public static boolean isLocUnderwater(Vector3fImmutable currentLoc) { + + float localAltitude = HeightMap.getWorldHeight(currentLoc); + Zone zone = findSmallestZone(currentLoc); + + return localAltitude < zone.getSeaLevel(); + } } diff --git a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java index f20d216c..3abbb6f2 100644 --- a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java +++ b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java @@ -2,7 +2,6 @@ package engine.net.client.handlers; import engine.Enum; import engine.Enum.*; -import engine.InterestManagement.HeightMap; import engine.InterestManagement.InterestManager; import engine.InterestManagement.RealmMap; import engine.InterestManagement.WorldGrid; @@ -112,7 +111,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Cannot place a tree underwater - if (HeightMap.isLocUnderwater(placementInfo.getLoc())) { + if (ZoneManager.isLocUnderwater(placementInfo.getLoc())) { PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater return false; } @@ -178,7 +177,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Cannot place a building underwater - if (HeightMap.isLocUnderwater(placementInfo.getLoc())) { + if (ZoneManager.isLocUnderwater(placementInfo.getLoc())) { PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater return false; } diff --git a/src/engine/objects/Bane.java b/src/engine/objects/Bane.java index 5b98aaa4..8ba5a1f9 100644 --- a/src/engine/objects/Bane.java +++ b/src/engine/objects/Bane.java @@ -13,7 +13,6 @@ import engine.Enum; import engine.Enum.ProtectionState; import engine.Enum.SiegePhase; import engine.Enum.SiegeResult; -import engine.InterestManagement.HeightMap; import engine.InterestManagement.WorldGrid; import engine.db.archive.BaneRecord; import engine.db.archive.DataWarehouse; @@ -135,7 +134,7 @@ public final class Bane { // Cannot place banestone underwater; - if (HeightMap.isLocUnderwater(player.getLoc())) { + if (ZoneManager.isLocUnderwater(player.getLoc())) { PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater return false; }