if (newmount.getType() instanceof WeaponType) {
// if so then I need to find out if it is the same class
// as the current weapon bay
// If the current bay is null, then it needs to be
// initialized
WeaponType weap = (WeaponType) newmount.getType();
if (bayMount == null) {
if (subCap) {
try {
bayMount = a.addEquipment(WeaponType.getSubCapBayType(weap.getAtClass()), nLoc, rearMount);
newBay = false;
} catch (LocationFullException ex) {
throw new EntityLoadingException(ex.getMessage());
}
} else {
try {
bayMount = a.addEquipment(WeaponType.getBayType(weap.getAtClass()), nLoc, rearMount);
newBay = false;
} catch (LocationFullException ex) {
throw new EntityLoadingException(ex.getMessage());
}
}
}
int damage = weap.getRoundShortAV();
if (weap.isCapital()) {
damage *= 10;
}
if (!newBay && (bayDamage + damage) <= 700 && bayMount.isRearMounted() == rearMount && weap.getAtClass() == ((WeaponType) bayMount.getType()).getAtClass() && !(((WeaponType) bayMount.getType()).isSubCapital() && !weap.isSubCapital())) {
// then we should add this weapon to the current bay
bayMount.addWeaponToBay(a.getEquipmentNum(newmount));
bayDamage += damage;
} else {
if (subCap) {
try {
bayMount = a.addEquipment(WeaponType.getSubCapBayType(weap.getAtClass()), nLoc, rearMount);
} catch (LocationFullException ex) {
throw new EntityLoadingException(ex.getMessage());
}
} else {
try {
bayMount = a.addEquipment(WeaponType.getBayType(weap.getAtClass()), nLoc, rearMount);
} catch (LocationFullException ex) {
throw new EntityLoadingException(ex.getMessage());
}
}
bayMount.addWeaponToBay(a.getEquipmentNum(newmount));