forked from MagicBane/Server
Update to validation order.
This commit is contained in:
@@ -96,26 +96,28 @@ public enum ForgeManager implements Runnable {
|
|||||||
|
|
||||||
public static int submit(WorkOrder workOrder) {
|
public static int submit(WorkOrder workOrder) {
|
||||||
|
|
||||||
// Make sure vendor can roll the formulae, warehouse can
|
// Must have a city to roll anything
|
||||||
// afford this wordOrder and other related checks.
|
|
||||||
|
|
||||||
int validation_result = WorkOrder.validate(workOrder);
|
|
||||||
|
|
||||||
// The return code is used by the submitter 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();
|
City city = workOrder.vendor.building.getCity();
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return 58; //58: The formula is beyond the means of this facility
|
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();
|
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 ItemProductionMsgHandler as a
|
||||||
|
// popup error message for the player.
|
||||||
|
|
||||||
|
if (validation_result != 0)
|
||||||
|
return validation_result;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Configure this production run.
|
// Configure this production run.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user