}
}
boolean rearMounted = (equipment instanceof WeaponType)
&& isRearMounted(critical);
if (equipment.isSpreadable()) {
Mounted m = spreadEquipment.get(equipment);
if (m != null) {
CriticalSlot criticalSlot = new CriticalSlot(
CriticalSlot.TYPE_EQUIPMENT, mech
.getEquipmentNum(m),
equipment.isHittable(), m);
mech.addCritical(location, criticalSlot);
if (criticalName
.equalsIgnoreCase("Armored Cowl")) {
mech.setCowl(5); // Initialize
// armored cowl
}
} else {
m = mech.addEquipment(equipment, location,
rearMounted);
spreadEquipment.put(equipment, m);
}
} else if ((equipment instanceof WeaponType)
&& equipment
.hasFlag(WeaponType.F_SPLITABLE)) {
// do we already have this one in this or an
// outer location?
Mounted m = null;
boolean bFound = false;
for (int x = 0, n = vSplitWeapons.size(); x < n; x++) {
m = vSplitWeapons.elementAt(x);
int nLoc = m.getLocation();
if (((nLoc == location) || (location == Mech
.getInnerLocation(nLoc)))
&& m.getType().equals(equipment)) {
bFound = true;
break;
}
}
if (bFound) {
m.setFoundCrits(m.getFoundCrits() + 1);
if (m.getFoundCrits() >= equipment
.getCriticals(mech)) {
vSplitWeapons.removeElement(m);
}
// if we're in a new location, set the
// weapon as split
if (location != m.getLocation()) {
m.setSplit(true);
}
// give the most restrictive location for
// arcs
int help = m.getLocation();
m.setLocation(Mech.mostRestrictiveLoc(
location, help));
if (location != help) {
m.setSecondLocation(Mech
.leastRestrictiveLoc(location,
help));
}
} else {
// make a new one
m = new Mounted(mech, equipment);
m.setFoundCrits(1);
vSplitWeapons.addElement(m);
}
mech.addEquipment(m, location, rearMounted);
} else {
mech.addEquipment(equipment, location,