Enumeration minefields = game.getMinefields(pos).elements(); while (minefields.hasMoreElements()) { Minefield mf = (Minefield) minefields.nextElement(); removeMinefield(mf); }
removeMinefieldsFrom(pos);
    private void resolveClearMinefieldAttempts(Vector clearAttempts) {        boolean[] doneWith = new boolean[clearAttempts.size()];        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_MINESWEEPER) ) {                        clear = Minefield.CLEAR_NUMBER_SWEEPER;                        boom = Minefield.CLEAR_NUMBER_SWEEPER_ACCIDENT;                        break;                    }                }                phaseReport.append( ent.getShortName() )                           .append( " attempts to clear mines in hex " )                           .append( pos.getBoardNum() )                           .append( "; needs a " )                           .append( clear )                           .append( ", rolls " )                           .append( roll );                if (roll >= clear) {                    phaseReport.append(" and is successful!\n");                    cleared = true;                } else if (roll <= boom) {                    phaseReport.append(" and accidently sets it off!\n");                    accident = true;                } else {                    phaseReport.append(" and fails!\n");                }            }            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);                                phaseReport.append(entity.getShortName() + " is damaged in minefield accident.");                                HitData hit = entity.rollHitLocation(Minefield.TO_HIT_TABLE, Minefield.TO_HIT_SIDE);                                phaseReport.append(damageEntity(entity, hit, mf.getDamage())).append("\n");                            }                            break;                        case (Minefield.TYPE_VIBRABOMB) :                            explodeVibrabomb(mf);                            break;                    }                }            }            if (cleared) {                Enumeration minefields = game.getMinefields(pos).elements();                while (minefields.hasMoreElements()) {                    Minefield mf = (Minefield) minefields.nextElement();                    removeMinefield(mf);                }            }        }    }