diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index 2a78868f..207de0cb 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -14,6 +14,7 @@ import engine.net.client.msg.ErrorPopupMsg; import engine.objects.Item; import engine.objects.ItemTemplate; import engine.objects.PlayerCharacter; +import engine.objects.Warehouse; import engine.powers.EffectsBase; import org.pmw.tinylog.Logger; @@ -30,6 +31,25 @@ public enum ForgeManager implements Runnable { public static final AtomicInteger wordOrderCounter = new AtomicInteger(0); public static HashMap oven = new HashMap(); + public static HashMap calcWarehouseOverflow(Warehouse warehouse, HashMap cost_map) { + + // Method returns a map of resourceType that a transaction overdrafts. + + HashMap overflowMap = new HashMap<>(); + + for (mbEnums.ResourceType resourceType : cost_map.keySet()) { + + int debit = warehouse.resources.get(resourceType) - cost_map.get(resourceType); + + // Locked resources are always unavailable + + if (debit < 0 || warehouse.locked.contains(resourceType)) + overflowMap.put(resourceType, debit); + } + + return overflowMap; + } + @Override public void run() { diff --git a/src/engine/objects/Warehouse.java b/src/engine/objects/Warehouse.java index 0bcdce7c..4891701e 100644 --- a/src/engine/objects/Warehouse.java +++ b/src/engine/objects/Warehouse.java @@ -635,22 +635,4 @@ public class Warehouse { return warehouse.locked.contains(resourceType); } - public static HashMap calcOverflow(Warehouse warehouse, HashMap cost_map) { - - // Method returns a map of resourceType that a transaction overdrafts. - - HashMap overflowMap = new HashMap<>(); - - for (mbEnums.ResourceType resourceType : cost_map.keySet()) { - - int debit = warehouse.resources.get(resourceType) - cost_map.get(resourceType); - - // Locked resources are always unavailable - - if (debit < 0 || warehouse.locked.contains(resourceType)) - overflowMap.put(resourceType, debit); - } - - return overflowMap; - } } \ No newline at end of file