Vector passengers = ent.getLoadedUnits(); Enumeration iter = passengers.elements(); while ( iter.hasMoreElements() ) { Entity other = (Entity) iter.nextElement(); if (other.isEnemyOf(ae) && other.hasActiveECM() && entPos != null) {  vEnemyCoords.addElement( entPos ); vECMRanges.addElement( new Integer(other.getECMRange()) ); } }
    public static boolean isAffectedByECM(Entity ae, Coords a, Coords b) {                if (a == null || b == null) return false;        // Only grab enemies with active ECM        Vector vEnemyCoords = new Vector(16);        Vector vECMRanges = new Vector(16);        for (Enumeration e = ae.game.getEntities(); e.hasMoreElements(); ) {            Entity ent = (Entity)e.nextElement();            if (ent.isEnemyOf(ae) && ent.hasActiveECM() && ent.getPosition() != null) {                // TODO : only use the best ECM range in a given Coords.                vEnemyCoords.addElement(ent.getPosition());                vECMRanges.addElement( new Integer(ent.getECMRange()) );            }        }                // none?  get out of here        if (vEnemyCoords.size() == 0) return false;                // get intervening Coords.  See the comments for intervening() and losDivided()        Coords[] coords = intervening(a, b);        boolean bDivided = (a.degree(b) % 60 == 30);        Enumeration ranges = vECMRanges.elements();        for (Enumeration e = vEnemyCoords.elements(); e.hasMoreElements(); ) {            Coords c = (Coords)e.nextElement();            int range = ( (Integer) ranges.nextElement() ).intValue();            int nLastDist = -1;                        // loop through intervening hexes and see if any of them are within range            for (int x = 0; x < coords.length; x++) {                int nDist = c.distance(coords[x]);                if ( nDist <= range ) return true;                                // optimization.  if we're getting farther away, forget it                // but ignore the doubled-up hexes intervening() adds along hexlines                if (!bDivided || (x % 3 == 0)) {                    if (nLastDist == -1) {                        nLastDist = nDist;                    }                    else if (nDist > nLastDist) {                        break;                    }                }            }        }        return false;    }    