Browse Source

comment cleanup

combat-2
MagicBot 7 months ago
parent
commit
3a514dc771
  1. 12
      src/engine/gameManager/ForgeManager.java
  2. 8
      src/engine/loot/WorkOrder.java

12
src/engine/gameManager/ForgeManager.java

@ -128,8 +128,8 @@ public enum ForgeManager implements Runnable { @@ -128,8 +128,8 @@ public enum ForgeManager implements Runnable {
int validation_result = WorkOrder.validate(workOrder);
// The return code is used by the ItemProductionMsgHandler as a
// popup error message for the player.
// The return code is used by the caller (ItemProductionMsgHandler)
// for display of a popup error message to the player.
if (validation_result != 0)
return validation_result;
@ -149,7 +149,7 @@ public enum ForgeManager implements Runnable { @@ -149,7 +149,7 @@ public enum ForgeManager implements Runnable {
if (!workOrder.multiple_slot_request && workOrder.total_to_produce == 0)
workOrder.total_to_produce = 1;
// Set total cost for this production run
// Set total cost for production run
workOrder.total_to_produce *= workOrder.slots_used;
@ -157,7 +157,7 @@ public enum ForgeManager implements Runnable { @@ -157,7 +157,7 @@ public enum ForgeManager implements Runnable {
workOrder.production_cost_total.putAll(workOrder.production_cost);
workOrder.production_cost_total.forEach((key, value) -> workOrder.production_cost_total.put(key, value * workOrder.total_to_produce));
// Withdraw gold and resource costs
// Withdraw gold and resource costs. Availability has previously been validated.
if (!WorkOrder.withdrawWorkOrderCost(workOrder))
return 58; //58: The formula is beyond the means of this facility
@ -166,8 +166,8 @@ public enum ForgeManager implements Runnable { @@ -166,8 +166,8 @@ public enum ForgeManager implements Runnable {
forgeWorkOrderBatch(workOrder);
// Enqueue workOrder for next completion cycle
// and assign it to the vendor
// Enqueue workOrder in the .forge and then
// add the workOrder to it's vendor
vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
forge.add(workOrder);

8
src/engine/loot/WorkOrder.java

@ -56,6 +56,9 @@ public class WorkOrder implements Delayed { @@ -56,6 +56,9 @@ public class WorkOrder implements Delayed {
public long completionTime;
public boolean runCompleted = false;
public boolean runCanceled = false;
// This collection is serialized to the vendor rolling window in ManageNPCMsg.
public ConcurrentHashMap.KeySetView<Item, Boolean> cooking = ConcurrentHashMap.newKeySet();
public WorkOrder() {
@ -64,6 +67,9 @@ public class WorkOrder implements Delayed { @@ -64,6 +67,9 @@ public class WorkOrder implements Delayed {
public WorkOrder(JSONObject jsonWorkOrder) {
// This constructor is used to load workOrders from disk
// during bootstrap. (dyn_workorders)
this.workOrderID = jsonWorkOrder.getInt("workOrderID");
this.vendor = NPC.getNPC(jsonWorkOrder.getInt("vendor"));
this.slots_used = jsonWorkOrder.getInt("slots_used");
@ -191,6 +197,8 @@ public class WorkOrder implements Delayed { @@ -191,6 +197,8 @@ public class WorkOrder implements Delayed {
public static JSONObject toJson(WorkOrder workOrder) {
// Workorders are persisted in JSON format.
JSONObject jsonWorkOrder = new JSONObject();
jsonWorkOrder.put("workOrderID", workOrder.workOrderID);

Loading…
Cancel
Save