Browse Source

reformat class

combat-2
MagicBot 9 months ago
parent
commit
94ab64d629
  1. 47
      src/engine/gameManager/ForgeManager.java

47
src/engine/gameManager/ForgeManager.java

@ -45,44 +45,45 @@ public enum ForgeManager implements Runnable { @@ -45,44 +45,45 @@ public enum ForgeManager implements Runnable {
Logger.error(e);
}
if (workOrder == null) {
Logger.error("NULL workOrder in queue");
// Null workOrders should not exist.
// Perhaps log?
if (workOrder == null)
continue;
}
// Completed or canceled work orders are not re-enqueued
if (workOrder.runCanceled || workOrder.runCompleted)
continue;
if (workOrder.runCanceled || workOrder.runCompleted)
continue;
// Create in memory items to add to collections
forgeItems(workOrder);
// Create in memory items to add to collections
Logger.info("item forged:" + workOrder.workOrderID + " (" + workOrder.total_produced + "/" + workOrder.total_to_produce + ")");
forgeItems(workOrder);
Logger.info("item forged:" + workOrder.workOrderID + " (" + workOrder.total_produced + "/" + workOrder.total_to_produce + ")");
if (workOrder.total_produced >= workOrder.total_to_produce) {
Logger.info("workOrder has completed: " + workOrder.workOrderID);
if (workOrder.total_produced >= workOrder.total_to_produce) {
// Persist current items that are currently building for this
// worker after first removing the negative id item from all
// collections.
Logger.info("workOrder has completed: " + workOrder.workOrderID);
// Add new item to the vendors inventory
// Persist current items that are currently building for this
// worker after first removing the negative id item from all
// collections.
workOrder.runCompleted = true;
workOrder.vendor.workOrders.remove(workOrder);
continue;
}
// Add new item to the vendors inventory
workOrder.runCompleted = true;
workOrder.vendor.workOrders.remove(workOrder);
continue;
}
// enQueue this workOrder again; back into the oven
// until all items for this workOrder are completed.
// enQueue this workOrder again; back into the oven
// until all items for this workOrder are completed.
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
forge.add(workOrder);
Logger.info(workOrder.toString());
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
forge.add(workOrder);
Logger.info(workOrder.toString());
}
}

Loading…
Cancel
Save