Browse Source

Class cleanup

combat-2
MagicBot 9 months ago
parent
commit
8fe7a6e896
  1. 13
      src/engine/gameManager/ForgeManager.java

13
src/engine/gameManager/ForgeManager.java

@ -25,7 +25,7 @@ public enum ForgeManager implements Runnable {
FORGE_MANAGER; FORGE_MANAGER;
private static final BlockingQueue<WorkOrder> oven = new DelayQueue<>(); private static final BlockingQueue<WorkOrder> forge = new DelayQueue<>();
public static final AtomicInteger wordOrderCounter = new AtomicInteger(0); public static final AtomicInteger wordOrderCounter = new AtomicInteger(0);
public static final HashMap<Item, WorkOrder> workOrderMap = new HashMap<Item, WorkOrder>(); public static final HashMap<Item, WorkOrder> workOrderMap = new HashMap<Item, WorkOrder>();
@ -35,7 +35,7 @@ public enum ForgeManager implements Runnable {
while (true) { while (true) {
try { try {
WorkOrder workOrder = oven.take(); WorkOrder workOrder = forge.take();
// Completed or canceled work orders are not re-enqueued // Completed or canceled work orders are not re-enqueued
@ -52,8 +52,9 @@ public enum ForgeManager implements Runnable {
Logger.info("workOrder has completed: " + workOrder.workOrderID); Logger.info("workOrder has completed: " + workOrder.workOrderID);
// Persist current items that are cooking // Persist current items that are currently building for this
// after removing the negative id item from all collections. // worker after first removing the negative id item from all
// collections.
// Add new item to the vendors inventory // Add new item to the vendors inventory
@ -67,7 +68,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;
oven.add(workOrder); forge.add(workOrder);
Logger.info(workOrder.toString()); Logger.info(workOrder.toString());
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -109,7 +110,7 @@ public enum ForgeManager implements Runnable {
Logger.info(workOrder.toString()); Logger.info(workOrder.toString());
workOrder.vendor.workOrders.add(workOrder); workOrder.vendor.workOrders.add(workOrder);
oven.add(workOrder); forge.add(workOrder);
} }
public static boolean validate(PlayerCharacter playerCharacter, WorkOrder workOrder) { public static boolean validate(PlayerCharacter playerCharacter, WorkOrder workOrder) {

Loading…
Cancel
Save