Browse Source

Method moved to manager.

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
bf9fdae58b
  1. 8
      src/engine/InterestManagement/HeightMap.java
  2. 8
      src/engine/gameManager/ZoneManager.java
  3. 5
      src/engine/net/client/handlers/PlaceAssetMsgHandler.java
  4. 3
      src/engine/objects/Bane.java

8
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) { private static void generatePixelData(HeightMap heightMap) {
Color color; Color color;

8
src/engine/gameManager/ZoneManager.java

@ -481,4 +481,12 @@ public enum ZoneManager {
return worldAlttitude; return worldAlttitude;
} }
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {
float localAltitude = HeightMap.getWorldHeight(currentLoc);
Zone zone = findSmallestZone(currentLoc);
return localAltitude < zone.getSeaLevel();
}
} }

5
src/engine/net/client/handlers/PlaceAssetMsgHandler.java

@ -2,7 +2,6 @@ package engine.net.client.handlers;
import engine.Enum; import engine.Enum;
import engine.Enum.*; import engine.Enum.*;
import engine.InterestManagement.HeightMap;
import engine.InterestManagement.InterestManager; import engine.InterestManagement.InterestManager;
import engine.InterestManagement.RealmMap; import engine.InterestManagement.RealmMap;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
@ -112,7 +111,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Cannot place a tree underwater // Cannot place a tree underwater
if (HeightMap.isLocUnderwater(placementInfo.getLoc())) { if (ZoneManager.isLocUnderwater(placementInfo.getLoc())) {
PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater
return false; return false;
} }
@ -178,7 +177,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Cannot place a building underwater // Cannot place a building underwater
if (HeightMap.isLocUnderwater(placementInfo.getLoc())) { if (ZoneManager.isLocUnderwater(placementInfo.getLoc())) {
PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater
return false; return false;
} }

3
src/engine/objects/Bane.java

@ -13,7 +13,6 @@ import engine.Enum;
import engine.Enum.ProtectionState; import engine.Enum.ProtectionState;
import engine.Enum.SiegePhase; import engine.Enum.SiegePhase;
import engine.Enum.SiegeResult; import engine.Enum.SiegeResult;
import engine.InterestManagement.HeightMap;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.db.archive.BaneRecord; import engine.db.archive.BaneRecord;
import engine.db.archive.DataWarehouse; import engine.db.archive.DataWarehouse;
@ -135,7 +134,7 @@ public final class Bane {
// Cannot place banestone underwater; // Cannot place banestone underwater;
if (HeightMap.isLocUnderwater(player.getLoc())) { if (ZoneManager.isLocUnderwater(player.getLoc())) {
PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater PlaceAssetMsg.sendPlaceAssetError(origin, 6, ""); // Cannot place underwater
return false; return false;
} }

Loading…
Cancel
Save