Browse Source

comment cleanup

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

17
src/engine/gameManager/ForgeManager.java

@ -31,9 +31,9 @@ public enum ForgeManager implements Runnable { @@ -31,9 +31,9 @@ public enum ForgeManager implements Runnable {
// MB Dev notes:
// Class handles all forge rolling mechanics for the game.
//
// WorkOrders may be submitted from any thread: usually (ItemProductionMsgHandler)
// as 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 may be submitted from any thread: usually (ItemProductionMsgHandler).
// Concurrency is managed by the same lock used by the warehouse (city.cityTransactionLock).
// WorkOrders are persisted then reconstituted at bootstrap from table dyn.workorders.
//
// p.s. replaces garbage code that looked like it was written by a crack head with face boils.
@ -53,10 +53,7 @@ public enum ForgeManager implements Runnable { @@ -53,10 +53,7 @@ public enum ForgeManager implements Runnable {
while (true) {
// .forge is a delayQueue (blocking priority queue using an epoc sort)
// workOrders are popped and processed when their completion time has passed.
//
// workOrders can be enqueued from any thread such as from a db handler
// however the game's interface should always be .submit(workOrder).
// workOrders are popped and processed when their completion time has passed..
try {
workOrder = forge.take();
@ -209,7 +206,7 @@ public enum ForgeManager implements Runnable { @@ -209,7 +206,7 @@ public enum ForgeManager implements Runnable {
int availableSlots = workOrder.vendor.getRank();
// Subtract slots currently assigned to npc workOrders
// Subtract the slots currently assigned to other workOrders for this vendor
for (WorkOrder npcWorkOrder : ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor))
availableSlots = availableSlots - npcWorkOrder.cooking.size();
@ -224,7 +221,7 @@ public enum ForgeManager implements Runnable { @@ -224,7 +221,7 @@ public enum ForgeManager implements Runnable {
public static HashMap<mbEnums.ResourceType, Integer> calcProductionCost(WorkOrder workOrder) {
// Calculate production cost for a single run of this workOrder
// Calculate production cost for a single run of the workOrder
HashMap<mbEnums.ResourceType, Integer> production_cost = new HashMap<>();
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
@ -363,7 +360,7 @@ public enum ForgeManager implements Runnable { @@ -363,7 +360,7 @@ public enum ForgeManager implements Runnable {
workOrder.total_produced = workOrder.total_produced + 1;
}
// Save updated state to disk
// Write updated workOrder to disk
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);

Loading…
Cancel
Save