From 9ba697c3106ef553d5514c219da3ec9deb911e3a Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 15 Apr 2024 11:30:56 -0400 Subject: [PATCH] Persist item work --- src/engine/gameManager/ForgeManager.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index ed43815c..616aeea7 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -61,8 +61,7 @@ public enum ForgeManager implements Runnable { if (workOrder.total_produced >= workOrder.total_to_produce) { - // Complete this workOrder. Persist items currently in memory - // and set the items as completed. + // Complete this workOrder. for (Item workOrderItem : workOrder.cooking) { ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_PRODUCE, true); @@ -71,7 +70,22 @@ public enum ForgeManager implements Runnable { Logger.info("workOrder has completed: " + workOrder.workOrderID); workOrder.runCompleted = true; + } + + if (workOrder.runCompleted == true) continue; + ; + + // Persist items that were currently cooking + + for (Item workOrderItem : workOrder.cooking) { + // 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); + ItemProductionMsg outMsg1 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_SETPRICE, true); + DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false); + ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true); + DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false); + } // Create new set in memory items