|
|
@ -29,13 +29,13 @@ import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
public enum ForgeManager implements Runnable { |
|
|
|
public enum ForgeManager implements Runnable { |
|
|
|
|
|
|
|
|
|
|
|
// MB Dev notes:
|
|
|
|
// MB Dev notes:
|
|
|
|
// Class handles all forge rolling mechanics for the game.
|
|
|
|
// Class handles all forge rolling mechanics for Magicbane.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// WorkOrders may be submitted from any thread: usually (ItemProductionMsgHandler).
|
|
|
|
// .submit(workOrder) may be called from any thread: (ItemProductionMsgHandler).
|
|
|
|
// Concurrency is managed by the same lock used by the warehouse (city.cityTransactionLock).
|
|
|
|
// Concurrency is managed by the same lock used by the warehouse (city.cityTransactionLock).
|
|
|
|
// WorkOrders are persisted then reconstituted at bootstrap from table dyn.workorders.
|
|
|
|
// WorkOrders are persisted then reconstituted at bootstrap using table dyn.workorders.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// p.s. replaces garbage code that looked like it was written by a crack head with face boils.
|
|
|
|
// p.s. replaces garbage code that looked like it was written by a mental patient with face boils.
|
|
|
|
|
|
|
|
|
|
|
|
FORGE_MANAGER; |
|
|
|
FORGE_MANAGER; |
|
|
|
|
|
|
|
|
|
|
@ -58,9 +58,13 @@ public enum ForgeManager implements Runnable { |
|
|
|
try { |
|
|
|
try { |
|
|
|
workOrder = forge.take(); |
|
|
|
workOrder = forge.take(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This workOrder has completed production.
|
|
|
|
|
|
|
|
|
|
|
|
if (workOrder.total_produced >= workOrder.total_to_produce) { |
|
|
|
if (workOrder.total_produced >= workOrder.total_to_produce) { |
|
|
|
|
|
|
|
|
|
|
|
// Complete this workOrder.
|
|
|
|
// Set items as completed in the window.
|
|
|
|
|
|
|
|
// First CONFIRM_PRODUCE adds virtual item to the interface.
|
|
|
|
|
|
|
|
// Second CONFIRM_PRODUCE sets virtual item to complete.
|
|
|
|
|
|
|
|
|
|
|
|
for (Item workOrderItem : workOrder.cooking) { |
|
|
|
for (Item workOrderItem : workOrder.cooking) { |
|
|
|
workOrderItem.flags.add(mbEnums.ItemFlags.Identified); |
|
|
|
workOrderItem.flags.add(mbEnums.ItemFlags.Identified); |
|
|
|