|
|
|
@ -14,6 +14,7 @@ import engine.net.client.msg.ErrorPopupMsg;
@@ -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 {
@@ -30,6 +31,25 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
public static final AtomicInteger wordOrderCounter = new AtomicInteger(0); |
|
|
|
|
public static HashMap<Item, WorkOrder> oven = new HashMap<Item, WorkOrder>(); |
|
|
|
|
|
|
|
|
|
public static HashMap<mbEnums.ResourceType, Integer> calcWarehouseOverflow(Warehouse warehouse, HashMap<mbEnums.ResourceType, Integer> cost_map) { |
|
|
|
|
|
|
|
|
|
// Method returns a map of resourceType that a transaction overdrafts.
|
|
|
|
|
|
|
|
|
|
HashMap<mbEnums.ResourceType, Integer> 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() { |
|
|
|
|
|
|
|
|
|