Enumeration equip = ent.getMisc(); while ( equip.hasMoreElements() ) { Mounted mounted = (Mounted) equip.nextElement();
for (Mounted mounted:ent.getMisc()) {
    private void resolveClearMinefieldAttempts(Vector clearAttempts) {        for (int i = 0; i < clearAttempts.size(); i++) {            Vector temp = new Vector();            Entity e = (Entity) clearAttempts.elementAt(i);            Coords pos = e.getPosition();            temp.addElement(e);            for (int j = i + 1; j < clearAttempts.size(); j++) {                Entity ent = (Entity) clearAttempts.elementAt(j);                if (ent.getPosition().equals(pos)) {                    temp.addElement(ent);                    clearAttempts.removeElement(ent);                }            }            boolean accident = false;            boolean cleared = false;            for (int j = 0; j < temp.size(); j++) {                Entity ent = (Entity) temp.elementAt(j);                int roll = Compute.d6(2);                int clear = Minefield.CLEAR_NUMBER_INFANTRY;                int boom = Minefield.CLEAR_NUMBER_INFANTRY_ACCIDENT;                // Does the entity has a minesweeper?                Enumeration equip = ent.getMisc();                while ( equip.hasMoreElements() ) {                    Mounted mounted = (Mounted) equip.nextElement();                    if ( mounted.getType().hasFlag(MiscType.F_TOOLS)                     && mounted.getType().hasSubType(MiscType.S_MINESWEEPER) ) {                        int sweeperType = mounted.getType().getToHitModifier();                        clear = Minefield.CLEAR_NUMBER_SWEEPER[sweeperType];                        boom = Minefield.CLEAR_NUMBER_SWEEPER_ACCIDENT[sweeperType];                        break;                    }                }                //mine clearing roll                Report r = new Report(2245);                r.subject = ent.getId();                r.add(ent.getShortName(), true);                r.add(pos.getBoardNum(), true);                r.add(clear);                r.add(roll);                r.newlines = 0;                addReport(r);                if (roll >= clear) {                    //success                    r = new Report(2250);                    r.subject = ent.getId();                    addReport(r);                    cleared = true;                } else if (roll <= boom) {                    //"click"...oops!                    r = new Report(2255);                    r.subject = ent.getId();                    addReport(r);                    accident = true;                } else {                    //failure                    r = new Report(2260);                    r.subject = ent.getId();                    addReport(r);                }            }            if (accident) {                Enumeration minefields = game.getMinefields(pos).elements();                while (minefields.hasMoreElements()) {                    Minefield mf = (Minefield) minefields.nextElement();                    switch (mf.getType()) {                        case (Minefield.TYPE_CONVENTIONAL) :                        case (Minefield.TYPE_THUNDER) :                            for (int j = 0; j < temp.size(); j++) {                                Entity entity = (Entity) temp.elementAt(j);                                Report r = new Report(2265);                                r.subject = entity.getId();                                r.add(entity.getShortName(), true);                                addReport(r);                                HitData hit = entity.rollHitLocation(Minefield.TO_HIT_TABLE, Minefield.TO_HIT_SIDE);                                addReport( damageEntity(entity, hit, mf.getDamage()));                                addNewLines();                            }                            break;                        case (Minefield.TYPE_VIBRABOMB) :                            explodeVibrabomb(mf);                            break;                    }                }            }            if (cleared) {                removeMinefieldsFrom(pos);            }        }    }