From c03f4640430fd22fb0507a3fa073086a93b95085 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 22 Apr 2024 15:12:46 -0400 Subject: [PATCH] More workorder db work --- .../client/handlers/ItemProductionMsgHandler.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/engine/net/client/handlers/ItemProductionMsgHandler.java b/src/engine/net/client/handlers/ItemProductionMsgHandler.java index 05528578..61657863 100644 --- a/src/engine/net/client/handlers/ItemProductionMsgHandler.java +++ b/src/engine/net/client/handlers/ItemProductionMsgHandler.java @@ -148,10 +148,13 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { workOrder.slots_used = workOrder.slots_used - 1; - // If this is the last item then remove the workOrder from the game + // Update workOrder on disk - if (workOrder.cooking.isEmpty()) + if (workOrder.cooking.isEmpty()) { ForgeManager.vendorWorkOrderLookup.get(vendor).remove(workOrder); + DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder); + } else + DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder); // Persist item and add to vendor inventory @@ -399,10 +402,13 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { workOrder.slots_used = workOrder.slots_used - 1; - // If this is the last item then remove the workOrder from the game + // Update workOrder on disk - if (workOrder.cooking.isEmpty()) + if (workOrder.cooking.isEmpty()) { ForgeManager.vendorWorkOrderLookup.get(vendor).remove(workOrder); + DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder); + } else + DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder); // Refresh vendor's inventory to client