From 5db5a260372a3ee76add724bc1a80132209a8d17 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 17 Mar 2024 11:29:30 -0400 Subject: [PATCH] Warehouse loading work. --- src/engine/objects/Warehouse.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/engine/objects/Warehouse.java b/src/engine/objects/Warehouse.java index a12dc7a4..b8c85884 100644 --- a/src/engine/objects/Warehouse.java +++ b/src/engine/objects/Warehouse.java @@ -30,14 +30,14 @@ import java.util.concurrent.ConcurrentHashMap; public class Warehouse { public EnumSet locked = EnumSet.noneOf(Enum.ResourceType.class); - public int buildingUID; + public Building building; public City city; public ArrayList transactions = new ArrayList<>(); public ConcurrentHashMap resources = new ConcurrentHashMap<>(); public Warehouse(Building building) { - this.buildingUID = building.objectUUID; + this.building = building; this.city = building.getCity(); // New empty warehouse @@ -604,16 +604,16 @@ public class Warehouse { } public static void loadAllTransactions(Warehouse warehouse) { - warehouse.transactions = DbManager.WarehouseQueries.GET_TRANSACTIONS_FOR_WAREHOUSE(warehouse.buildingUID); + warehouse.transactions = DbManager.WarehouseQueries.GET_TRANSACTIONS_FOR_WAREHOUSE(warehouse.building.getObjectUUID()); } public static void AddTransactionToWarehouse(Warehouse warehouse, Enum.GameObjectType targetType, int targetUUID, Enum.TransactionType transactionType, Enum.ResourceType resource, int amount) { - if (!DbManager.WarehouseQueries.CREATE_TRANSACTION(warehouse.buildingUID, targetType, targetUUID, transactionType, resource, amount, DateTime.now())) + if (!DbManager.WarehouseQueries.CREATE_TRANSACTION(warehouse.building.getObjectUUID(), targetType, targetUUID, transactionType, resource, amount, DateTime.now())) return; - Transaction transaction = new Transaction(warehouse.buildingUID, targetType, targetUUID, transactionType, resource, amount, DateTime.now()); + Transaction transaction = new Transaction(warehouse.building.getObjectUUID(), targetType, targetUUID, transactionType, resource, amount, DateTime.now()); warehouse.transactions.add(transaction); }