public static boolean hasValidCover(IGame game,Coords pos,int elevation){
  if ((pos == null) || (elevation > 0)) {
    return false;
  }
  boolean hasMovedEntity=false;
  for (  Entity e : game.getEntitiesVector(pos)) {
    if (e.isDone() && !(e instanceof Infantry) && (e.getElevation() == elevation)) {
      hasMovedEntity=true;
      break;
    }
  }
  if (!hasMovedEntity) {
    Enumeration<Entity> wrecks=game.getWreckedEntities();
    while (wrecks.hasMoreElements()) {
      Entity e=wrecks.nextElement();
      if (pos.equals(e.getPosition()) && !(e instanceof Infantry)) {
        hasMovedEntity=true;
      }
    }
  }
  return hasMovedEntity;
}

public static boolean hasValidCover ( IGame game , Coords pos , int elevation ) { if ( ( pos == null ) || ( elevation > 0 ) ) { return false ; } boolean hasMovedEntity = false ; for ( Entity e : game . getEntitiesVector ( pos ) ) { if ( e . isDone ( ) && ! ( e instanceof Infantry ) && ( e . getElevation ( ) == elevation ) ) { hasMovedEntity = true ; break ; } } if ( ! hasMovedEntity ) { Enumeration < Entity > wrecks = game . getWreckedEntities ( ) ; while ( wrecks . hasMoreElements ( ) ) { Entity e = wrecks . nextElement ( ) ; if ( pos . equals ( e . getPosition ( ) ) && ! ( e instanceof Infantry ) ) { hasMovedEntity = true ; } } } return hasMovedEntity ; }
determines if there is valid cover for an infantry unit to utilize the using non - infantry as cover rules ( to pg 108 ) .
