WeaponAttackAction waa = (WeaponAttackAction)e.nextElement(); Entity attacker = waa.getEntity(client.game); Targetable target = waa.getTarget(client.game); boolean curInFrontArc = Compute.isInArc(attacker.getPosition(), attacker.getSecondaryFacing(), target.getPosition(), Compute.ARC_FORWARD); if (!curInFrontArc) { WeaponAttackAction waa2 = new WeaponAttackAction(waa.getEntityId(), waa.getTargetType(), waa.getTargetId(), waa.getWeaponId() ); newAttacks.addElement(waa2);
Object o = e.nextElement(); if (o instanceof WeaponAttackAction) { WeaponAttackAction waa = (WeaponAttackAction)e.nextElement(); Entity attacker = waa.getEntity(client.game); Targetable target = waa.getTarget(client.game); boolean curInFrontArc = Compute.isInArc(attacker.getPosition(), attacker.getSecondaryFacing(), target.getPosition(), Compute.ARC_FORWARD); if (!curInFrontArc) { WeaponAttackAction waa2 = new WeaponAttackAction(waa.getEntityId(), waa.getTargetType(), waa.getTargetId(), waa.getWeaponId() ); newAttacks.addElement(waa2); }
    private void ready() {        if (attacks.isEmpty() && GUIPreferences.getInstance().getNagForNoAction()) {            // comfirm this action            String title = Messages.getString("FiringDisplay.DontFireDialog.title"); //$NON-NLS-1$            String body = Messages.getString("FiringDisplay.DontFireDialog.message"); //$NON-NLS-1$            ConfirmDialog response = clientgui.doYesNoBotherDialog(title, body);            if ( !response.getShowAgain() ) {                GUIPreferences.getInstance().setNagForNoAction(false);            }            if ( !response.getAnswer() ) {                return;            }        }        // auto spot if we can and the option is set        if (attacks.isEmpty() &&             client.game.getOptions().booleanOption("auto_spot") && //$NON-NLS-1$                client.game.getPhase() == IGame.PHASE_FIRING) {            if (!ce().isINarcedWith( INarcPod.HAYWIRE)) {                // if we might do physicals, ask for confirmation                if (ce().isEligibleForPhysical()) {                    doSpot();                // else, spot without asking                } else {                    attacks.addElement(new SpotAction(cen));                }            }        }        // stop further input (hopefully)        disableButtons();        // remove temporary attacks from game & board        removeTempAttacks();                // For bug 1002223        // Re-compute the to-hit numbers by adding in correct order.        Vector newAttacks = new Vector();        for (Enumeration e=attacks.elements(); e.hasMoreElements();) {            WeaponAttackAction waa = (WeaponAttackAction)e.nextElement();            Entity attacker = waa.getEntity(client.game);            Targetable target = waa.getTarget(client.game);            boolean curInFrontArc = Compute.isInArc(attacker.getPosition(), attacker.getSecondaryFacing(), target.getPosition(), Compute.ARC_FORWARD);            if (curInFrontArc) {                WeaponAttackAction waa2 = new WeaponAttackAction(waa.getEntityId(), waa.getTargetType(), waa.getTargetId(), waa.getWeaponId());                newAttacks.addElement(waa2);            }        }        for (Enumeration e=attacks.elements(); e.hasMoreElements();) {            WeaponAttackAction waa = (WeaponAttackAction)e.nextElement();            Entity attacker = waa.getEntity(client.game);            Targetable target = waa.getTarget(client.game);            boolean curInFrontArc = Compute.isInArc(attacker.getPosition(), attacker.getSecondaryFacing(), target.getPosition(), Compute.ARC_FORWARD);            if (!curInFrontArc) {                WeaponAttackAction waa2 = new WeaponAttackAction(waa.getEntityId(), waa.getTargetType(), waa.getTargetId(), waa.getWeaponId() );                newAttacks.addElement(waa2);            }        }                // send out attacks        client.sendAttackData(cen, newAttacks);                // clear queue        attacks.removeAllElements();        // Clear the menu bar.        clientgui.getMenuBar().setEntity( null );        // close aimed shot display, if any        ash.closeDialog();        ash.lockLocation(false);    }