|
|
|
@ -96,26 +96,28 @@ public enum ForgeManager implements Runnable {
@@ -96,26 +96,28 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
public static int submit(WorkOrder workOrder) { |
|
|
|
|
|
|
|
|
|
// Must have a city to roll anything
|
|
|
|
|
|
|
|
|
|
City city = workOrder.vendor.building.getCity(); |
|
|
|
|
|
|
|
|
|
if (city == null) |
|
|
|
|
return 58; //58: The formula is beyond the means of this facility
|
|
|
|
|
|
|
|
|
|
// Concurrency is rightly managed by same lock as warehouse
|
|
|
|
|
|
|
|
|
|
city.transactionLock.writeLock().lock(); |
|
|
|
|
|
|
|
|
|
// Make sure vendor can roll the formulae, warehouse can
|
|
|
|
|
// afford this wordOrder and other related checks.
|
|
|
|
|
|
|
|
|
|
int validation_result = WorkOrder.validate(workOrder); |
|
|
|
|
|
|
|
|
|
// The return code is used by the submitter as a
|
|
|
|
|
// The return code is used by the ItemProductionMsgHandler as a
|
|
|
|
|
// popup error message for the player.
|
|
|
|
|
|
|
|
|
|
if (validation_result != 0) |
|
|
|
|
return validation_result; |
|
|
|
|
|
|
|
|
|
// Concurrency is managed by same lock as warehouse
|
|
|
|
|
|
|
|
|
|
City city = workOrder.vendor.building.getCity(); |
|
|
|
|
|
|
|
|
|
if (city == null) |
|
|
|
|
return 58; //58: The formula is beyond the means of this facility
|
|
|
|
|
|
|
|
|
|
city.transactionLock.writeLock().lock(); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
// Configure this production run.
|
|
|
|
|
|
|
|
|
|