boolean revertsToSingleShot = false;
    private WeaponResult addHeatUseAmmoFor(WeaponAttackAction waa, WeaponResult wr) {        final Entity ae = game.getEntity(waa.getEntityId());        final Mounted weapon = ae.getEquipment(waa.getWeaponId());        final WeaponType wtype = (WeaponType)weapon.getType();        // 2003-01-02 BattleArmor MG and Small Lasers have unlimited ammo.        final boolean usesAmmo = wtype.getAmmoType() != AmmoType.T_NA &&            wtype.getAmmoType() != AmmoType.T_BA_MG &&            wtype.getAmmoType() != AmmoType.T_BA_SMALL_LASER &&            !wtype.hasFlag(WeaponType.F_INFANTRY);        Mounted ammo = weapon.getLinked();                boolean revertsToSingleShot = false;                // how many shots are we firing?        int nShots = howManyShots(weapon, ammo);                // do we need to revert to single shot?        if (usesAmmo && nShots > 1) {            int nAvail = ae.getTotalAmmoOfType((AmmoType)ammo.getType());            if (nAvail < nShots) {                wr.revertsToSingleShot = true;                nShots = 1;            }        }                // use up ammo        if (usesAmmo) {            for (int i = 0; i < nShots; i++) {                if (ammo.getShotsLeft() <= 0) {                    ae.loadWeapon(weapon);                    ammo = weapon.getLinked();                }                ammo.setShotsLeft(ammo.getShotsLeft() - 1);            }        }                // build up some heat        ae.heatBuildup += (wtype.getHeat() * nShots);                return wr;    }