@ -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);
@ -35,6 +35,21 @@ public class Warehouse {
public ArrayList<Transaction> transactions = new ArrayList<>();
public ConcurrentHashMap<Enum.ResourceType, Integer> 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 {