Browse Source

Method to calculate warehosue overflow.

combat-2
MagicBot 7 months ago
parent
commit
7c4f7f391b
  1. 12
      src/engine/objects/Warehouse.java

12
src/engine/objects/Warehouse.java

@ -640,4 +640,16 @@ public class Warehouse { @@ -640,4 +640,16 @@ public class Warehouse {
return warehouse.locked.contains(resourceType);
}
public static HashMap<mbEnums.ResourceType, Integer> calcOverflow(Warehouse warehouse, HashMap<mbEnums.ResourceType, Integer> cost_map) {
HashMap<mbEnums.ResourceType, Integer> overflowMap = new HashMap<>();
for (mbEnums.ResourceType resourceType : cost_map.keySet()) {
int debit = warehouse.resources.get(resourceType) - cost_map.get(resourceType);
if (debit < 0)
overflowMap.put(resourceType, debit);
}
return overflowMap;
}
}
Loading…
Cancel
Save