diff --git a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java index 7a7826e0..17727592 100644 --- a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java +++ b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java @@ -1343,6 +1343,10 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { return false; } + Warehouse warehouse = new Warehouse(warehouseBuilding); + city.warehouse = warehouse; + DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse); + // Load the building into the simulation warehouseBuilding.setObjectTypeMask(MBServerStatics.MASK_BUILDING); diff --git a/src/engine/objects/Warehouse.java b/src/engine/objects/Warehouse.java index 472b0d3c..1230ccb6 100644 --- a/src/engine/objects/Warehouse.java +++ b/src/engine/objects/Warehouse.java @@ -35,6 +35,21 @@ public class Warehouse { public ArrayList transactions = new ArrayList<>(); public ConcurrentHashMap resources = new ConcurrentHashMap<>(); + public Warehouse(Building building) { + + this.buildingUID = building.objectUUID; + this.city = building.getCity(); + + // New empty warehouse + + for (Enum.ResourceType resourceType : EnumSet.allOf(Enum.ResourceType.class)) + this.resources.put(resourceType, 0); + + // With no locks + + this.locked = EnumSet.noneOf(Enum.ResourceType.class); + } + public Warehouse(JSONObject warehouse) throws SQLException {