diff --git a/src/engine/net/client/handlers/DestroyBuildingHandler.java b/src/engine/net/client/handlers/DestroyBuildingHandler.java index ddebbd07..a4a6141c 100644 --- a/src/engine/net/client/handlers/DestroyBuildingHandler.java +++ b/src/engine/net/client/handlers/DestroyBuildingHandler.java @@ -1,10 +1,10 @@ package engine.net.client.handlers; -import engine.mbEnums; -import engine.mbEnums.BuildingGroup; import engine.InterestManagement.WorldGrid; import engine.exception.MsgSendException; import engine.gameManager.BuildingManager; +import engine.mbEnums; +import engine.mbEnums.BuildingGroup; import engine.net.client.ClientConnection; import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.DestroyBuildingMsg; @@ -91,8 +91,9 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler { building.disableSpire(true); if (blueprint.getBuildingGroup() == BuildingGroup.WAREHOUSE) { + if (city != null) - city.setWarehouseBuildingID(0); + city.warehouse = null; } BuildingManager.setRank(building, -1); diff --git a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java index d6b0ad59..582a8e74 100644 --- a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java +++ b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java @@ -1358,8 +1358,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { if (city == null) return true; - city.setWarehouseBuildingID(newMesh.getObjectUUID()); - return true; } } \ No newline at end of file diff --git a/src/engine/net/client/handlers/ViewResourcesMsgHandler.java b/src/engine/net/client/handlers/ViewResourcesMsgHandler.java index 731e47e2..61bbe598 100644 --- a/src/engine/net/client/handlers/ViewResourcesMsgHandler.java +++ b/src/engine/net/client/handlers/ViewResourcesMsgHandler.java @@ -8,9 +8,8 @@ package engine.net.client.handlers; -import engine.mbEnums.DispatchChannel; import engine.exception.MsgSendException; -import engine.gameManager.BuildingManager; +import engine.mbEnums.DispatchChannel; import engine.net.Dispatch; import engine.net.DispatchMessage; import engine.net.client.ClientConnection; @@ -46,13 +45,16 @@ public class ViewResourcesMsgHandler extends AbstractClientMsgHandler { if (city == null) return true; - Building warehouse = BuildingManager.getBuilding(city.getWarehouseBuildingID()); + if (city.warehouse == null) + return true; + + Building warehouseBuilding = city.warehouse.building; - if (warehouse == null) + if (warehouseBuilding == null) return true; ViewResourcesMsg vrm = new ViewResourcesMsg(playerCharacter); - vrm.setWarehouseBuilding(warehouse); + vrm.setWarehouseBuilding(warehouseBuilding); vrm.setGuild(playerCharacter.getGuild()); vrm.configure(); diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 92feb734..74cb81dd 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -78,7 +78,6 @@ public class City extends AbstractWorldObject { private Vector3fImmutable location = Vector3fImmutable.ZERO; // Players who have entered the city (used for adding and removing affects) private Vector3fImmutable bindLoc; - private int warehouseBuildingID = 0; private boolean open = false; private String hash; public Warehouse warehouse; @@ -1060,14 +1059,6 @@ public class City extends AbstractWorldObject { } } - public int getWarehouseBuildingID() { - return warehouseBuildingID; - } - - public void setWarehouseBuildingID(int warehouseBuildingID) { - this.warehouseBuildingID = warehouseBuildingID; - } - public final void destroy() { Thread destroyCityThread = new Thread(new DestroyCityThread(this));