Browse Source

Collection declaration cleanup

combat-2
MagicBot 7 months ago
parent
commit
f068e6891e
  1. 12
      src/engine/gameManager/ForgeManager.java

12
src/engine/gameManager/ForgeManager.java

@ -25,9 +25,9 @@ public enum ForgeManager implements Runnable {
FORGE_MANAGER; FORGE_MANAGER;
private static final BlockingQueue<WorkOrder> workOrders = new DelayQueue(); private static final BlockingQueue<WorkOrder> oven = new DelayQueue<>();
public static final AtomicInteger wordOrderCounter = new AtomicInteger(0); public static final AtomicInteger wordOrderCounter = new AtomicInteger(0);
public static HashMap<Item, WorkOrder> oven = new HashMap<Item, WorkOrder>(); public static final HashMap<Item, WorkOrder> workOrderMap = new HashMap<Item, WorkOrder>();
@Override @Override
public void run() { public void run() {
@ -35,7 +35,7 @@ public enum ForgeManager implements Runnable {
while (true) { while (true) {
try { try {
WorkOrder workOrder = workOrders.take(); WorkOrder workOrder = oven.take();
// Completed or canceled work orders are not re-enqueued // Completed or canceled work orders are not re-enqueued
@ -67,7 +67,7 @@ public enum ForgeManager implements Runnable {
// until all items for this workOrder are completed. // until all items for this workOrder are completed.
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
workOrders.add(workOrder); oven.add(workOrder);
Logger.info(workOrder.toString()); Logger.info(workOrder.toString());
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -109,7 +109,7 @@ public enum ForgeManager implements Runnable {
Logger.info(workOrder.toString()); Logger.info(workOrder.toString());
workOrder.vendor.workOrders.add(workOrder); workOrder.vendor.workOrders.add(workOrder);
workOrders.add(workOrder); oven.add(workOrder);
} }
public static boolean validate(PlayerCharacter playerCharacter, WorkOrder workOrder) { public static boolean validate(PlayerCharacter playerCharacter, WorkOrder workOrder) {
@ -268,7 +268,7 @@ public enum ForgeManager implements Runnable {
for (int i = 0; i < workOrder.slots_used; ++i) { for (int i = 0; i < workOrder.slots_used; ++i) {
Item forged_item = forgeItem(workOrder); Item forged_item = forgeItem(workOrder);
ForgeManager.oven.put(forged_item, workOrder); ForgeManager.workOrderMap.put(forged_item, workOrder);
workOrder.cooking.add(forged_item); workOrder.cooking.add(forged_item);

Loading…
Cancel
Save