comment cleanup
This commit is contained in:
@@ -31,9 +31,9 @@ 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 the game.
|
||||||
//
|
//
|
||||||
// WorkOrders may be submitted from any thread: usually (ItemProductionMsgHandler)
|
// WorkOrders may be submitted from any thread: usually (ItemProductionMsgHandler).
|
||||||
// as 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 from 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 crack head with face boils.
|
||||||
|
|
||||||
@@ -53,10 +53,7 @@ public enum ForgeManager implements Runnable {
|
|||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
// .forge is a delayQueue (blocking priority queue using an epoc sort)
|
// .forge is a delayQueue (blocking priority queue using an epoc sort)
|
||||||
// workOrders are popped and processed when their completion time has passed.
|
// 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).
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
workOrder = forge.take();
|
workOrder = forge.take();
|
||||||
@@ -209,7 +206,7 @@ public enum ForgeManager implements Runnable {
|
|||||||
|
|
||||||
int availableSlots = workOrder.vendor.getRank();
|
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))
|
for (WorkOrder npcWorkOrder : ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor))
|
||||||
availableSlots = availableSlots - npcWorkOrder.cooking.size();
|
availableSlots = availableSlots - npcWorkOrder.cooking.size();
|
||||||
@@ -224,7 +221,7 @@ public enum ForgeManager implements Runnable {
|
|||||||
|
|
||||||
public static HashMap<mbEnums.ResourceType, Integer> calcProductionCost(WorkOrder workOrder) {
|
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<>();
|
HashMap<mbEnums.ResourceType, Integer> production_cost = new HashMap<>();
|
||||||
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
|
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
|
||||||
@@ -363,7 +360,7 @@ public enum ForgeManager implements Runnable {
|
|||||||
workOrder.total_produced = workOrder.total_produced + 1;
|
workOrder.total_produced = workOrder.total_produced + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save updated state to disk
|
// Write updated workOrder to disk
|
||||||
|
|
||||||
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);
|
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user