From c545468f26f8e01369580ea5f568c431943eabf1 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 11 May 2024 08:49:44 -0400 Subject: [PATCH] Update to workOrder cleanup --- src/engine/gameManager/BuildingManager.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 2b27372b..ea2712da 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -329,12 +329,16 @@ public enum BuildingManager { } // Clear all workorders for this hireling - if (hireling.getObjectType().equals(GameObjectType.NPC)) - if (ForgeManager.vendorWorkOrderLookup.contains(hireling)) - for (WorkOrder workOrder : ForgeManager.vendorWorkOrderLookup.get(hireling)) { + if (hireling.getObjectType().equals(GameObjectType.NPC)) { + + NPC hirelingNPC = (NPC) hireling; + + if (ForgeManager.vendorWorkOrderLookup.get(hirelingNPC) != null) + for (WorkOrder workOrder : ForgeManager.vendorWorkOrderLookup.get(hirelingNPC)) { workOrder.runCompleted = true; DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder); } + } // Remove hireling from building building.getHirelings().remove(hireling);