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