diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index b720280b..67b6ab1b 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -42,46 +42,47 @@ public enum ForgeManager implements Runnable { try { workOrder = forge.take(); - } catch (Exception e) { - Logger.error(e); - } - if (workOrder.total_produced >= workOrder.total_to_produce) { + if (workOrder.total_produced >= workOrder.total_to_produce) { - // Complete this workOrder. + // Complete this workOrder. - for (Item workOrderItem : workOrder.cooking) { - workOrderItem.flags.add(mbEnums.ItemFlags.Identified); - ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_PRODUCE, true); - DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false); - } + for (Item workOrderItem : workOrder.cooking) { + workOrderItem.flags.add(mbEnums.ItemFlags.Identified); + ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_PRODUCE, true); + DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false); + } - workOrder.runCompleted = true; + workOrder.runCompleted = true; - // Update workorder to disk + // Update workorder to disk - DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder); - } + DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder); + } - if (workOrder.runCompleted) - continue; + if (workOrder.runCompleted) + continue; - // Move current cooking batch to vendor inventory + // Move current cooking batch to vendor inventory - completeWorkOrderBatch(workOrder); + completeWorkOrderBatch(workOrder); - // Create new set of in-memory only virtual items + // Create new set of in-memory only virtual items - forgeWorkOrderBatch(workOrder); + forgeWorkOrderBatch(workOrder); - // 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. - forge.add(workOrder); + forge.add(workOrder); + + // Debugging - // Debugging + Logger.info(workOrder.toString()); - Logger.info(workOrder.toString()); + } catch (Exception e) { + Logger.error(e); + } } }