lastAction = attacks.lastElement();
} catch (NoSuchElementException ex) {
// ignore
}
if ((lastAction != null) && (lastAction instanceof WeaponAttackAction)) {
WeaponAttackAction oldWaa = (WeaponAttackAction) lastAction;
Targetable oldTarget = oldWaa.getTarget(client.game);
if (!oldTarget.equals(target)) {
boolean oldInFront = Compute.isInArc(ce().getPosition(),
ce().getSecondaryFacing(), oldTarget.getPosition(),
Compute.ARC_FORWARD);
boolean curInFront = Compute.isInArc(ce().getPosition(),
ce().getSecondaryFacing(), target.getPosition(),
Compute.ARC_FORWARD);
if (!oldInFront && curInFront) {
String title = Messages
.getString("FiringDisplay.SecondaryTargetToHitChange.title"); //$NON-NLS-1$
String body = Messages
.getString("FiringDisplay.SecondaryTargetToHitChange.message"); //$NON-NLS-1$
if (!clientgui.doYesNoDialog(title, body)) {
return;
}
}
}
}
}
// declare searchlight, if possible
if (GUIPreferences.getInstance().getAutoDeclareSearchlight()) {
doSearchlight();
}
WeaponAttackAction waa;
if (!mounted.getType().hasFlag(WeaponType.F_ARTILLERY)) {
waa = new WeaponAttackAction(cen, target.getTargetType(), target
.getTargetId(), weaponNum);
} else {
waa = new ArtilleryAttackAction(cen, target.getTargetType(), target
.getTargetId(), weaponNum, client.game);
}
// if this is a space bomb attack, then bring up the payload dialog
if (mounted.getType().hasFlag(WeaponType.F_SPACE_BOMB)) {
// if the user cancels, then return
int[] payload = doSpaceBombing();
waa.setBombPayload(payload);
}
if ((mounted.getLinked() != null)
&& (((WeaponType) mounted.getType()).getAmmoType() != AmmoType.T_NA)) {
Mounted ammoMount = mounted.getLinked();
AmmoType ammoType = (AmmoType) ammoMount.getType();
waa.setAmmoId(ce().getEquipmentNum(ammoMount));
if (((ammoType.getMunitionType() == AmmoType.M_THUNDER_VIBRABOMB) && ((ammoType
.getAmmoType() == AmmoType.T_LRM) || (ammoType.getAmmoType() == AmmoType.T_MML)))
|| (ammoType.getMunitionType() == AmmoType.M_VIBRABOMB_IV)) {
VibrabombSettingDialog vsd = new VibrabombSettingDialog(
clientgui.frame);
vsd.setVisible(true);
waa.setOtherAttackInfo(vsd.getSetting());
}
}
if (ash.allowAimedShotWith(mounted) && ash.inAimingMode()
&& ash.isAimingAtLocation()) {
waa.setAimedLocation(ash.getAimingAt());
waa.setAimingMode(ash.getAimingMode());
} else {
waa.setAimedLocation(Entity.LOC_NONE);
waa.setAimingMode(IAimingModes.AIM_MODE_NONE);
}
// add the attack to our temporary queue
attacks.addElement(waa);