Browse Source

File reformat

combat-2
MagicBot 7 months ago
parent
commit
dc83bee227
  1. 36
      src/engine/gameManager/ForgeManager.java

36
src/engine/gameManager/ForgeManager.java

@ -109,35 +109,35 @@ public enum ForgeManager implements Runnable {
city.transactionLock.writeLock().lock(); city.transactionLock.writeLock().lock();
try { try {
// Configure this production run. // Configure this production run.
workOrder.workOrderID = wordOrderCounter.incrementAndGet(); workOrder.workOrderID = wordOrderCounter.incrementAndGet();
workOrder.rollingDuration = ForgeManager.calcRollingDuration(workOrder); workOrder.rollingDuration = ForgeManager.calcRollingDuration(workOrder);
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
workOrder.slots_used = calcAvailableSlots(workOrder); workOrder.slots_used = calcAvailableSlots(workOrder);
workOrder.total_produced = 0; workOrder.total_produced = 0;
workOrder.total_to_produce *= workOrder.slots_used; workOrder.total_to_produce *= workOrder.slots_used;
workOrder.production_cost = calcProductionCost(workOrder); workOrder.production_cost = calcProductionCost(workOrder);
// Set total cost for this production run // Set total cost for this production run
workOrder.production_cost_total.putAll(workOrder.production_cost); 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.production_cost_total.forEach((key, value) -> workOrder.production_cost_total.compute(key, (k, v) -> v * workOrder.total_to_produce));
// Deduct gold cost from building // Deduct gold cost from building
if (debitWorkOrderCost(workOrder) == false) if (!debitWorkOrderCost(workOrder))
return 58; //58: The formula is beyond the means of this facility return 58; //58: The formula is beyond the means of this facility
// Create in-memory items and add to collections // Create in-memory items and add to collections
forgeWorkOrderBatch(workOrder); forgeWorkOrderBatch(workOrder);
// Submit workOrder for next completion cycle // Submit workOrder for next completion cycle
vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder); vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
forge.add(workOrder); forge.add(workOrder);
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);

Loading…
Cancel
Save