From 0f2b46b898147c49ba4078cf24d9d4eb4396d2bd Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 19 Apr 2024 09:20:01 -0400 Subject: [PATCH] Window refresh update --- src/engine/gameManager/ForgeManager.java | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index e57db32f..7dd46661 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -323,10 +323,13 @@ public enum ForgeManager implements Runnable { public static void completeWorkOrderBatch(WorkOrder workOrder) { - ArrayList toRemove = new ArrayList<>(); - for (Item workOrderItem : workOrder.cooking) { + // Remove the virtual items from the forge window + + workOrder.cooking.remove(workOrderItem); + itemWorkOrderLookup.remove(workOrderItem); + // Persist item Item completedItem = DbManager.ItemQueries.PERSIST(workOrderItem); @@ -339,23 +342,6 @@ public enum ForgeManager implements Runnable { DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false); ItemProductionMsg outMsg2 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, completedItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true); DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false); - - toRemove.add(workOrderItem); - } - - // Remove the negativeID virtual item from all collections - // other than the virtual item lookup map. Item will be - // persisted when bought/taken from vendor. - - for (Item memoryItem : toRemove) { - - // Remove the virtual items from the forge window - - ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, memoryItem, mbEnums.ProductionActionType.CONFIRM_SETPRICE, true); - DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false); - - workOrder.cooking.remove(memoryItem); - itemWorkOrderLookup.remove(memoryItem); } }