From 01113fc3a695a089d1b0410a3a8e235d7b466e2d Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 17 Apr 2024 14:24:05 -0400 Subject: [PATCH] Configure before setting cost --- src/engine/gameManager/ForgeManager.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index c5180464..9a29a29f 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -113,8 +113,10 @@ public enum ForgeManager implements Runnable { workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; workOrder.slots_used = calcAvailableSlots(workOrder); - // Cost to execute this workOrder + // Configure this production run. + workOrder.total_produced = 0; + workOrder.total_to_produce *= workOrder.slots_used; workOrder.production_cost = calcProductionCost(workOrder); // Set total cost for this production run @@ -122,9 +124,6 @@ public enum ForgeManager implements Runnable { workOrder.production_cost_total.putAll(workOrder.production_cost); workOrder.production_cost_total.forEach((key, value) -> workOrder.production_cost_total.compute(key, (k, v) -> v * workOrder.total_to_produce)); - workOrder.total_produced = 0; - workOrder.total_to_produce *= workOrder.slots_used; - // Create in-memory items and add to collections forgeWorkerOrderBatch(workOrder);