while ((Compute.stackingViolation(game, entity, coords, null) != null) && (entity.getElevation() <= 50)) { ((VTOL)entity).setElevation(entity.getElevation() + 1); } if (entity.getElevation() > 50) { throw new IllegalStateException("Entity #" + entity.getId() + " appears to be in an infinite loop trying to get a legal elevation."); }
    private void processDeployment(Entity entity, Coords coords, int nFacing, Vector loadVector) {        for (Enumeration i = loadVector.elements(); i.hasMoreElements();) {            Entity loaded = (Entity)i.nextElement();            if ( loaded == null || loaded.getPosition() != null ||                 loaded.getTransportId() != Entity.NONE ) {                // Something is fishy in Denmark.                System.err.println("error: " + entity + " can not load entity #" + loaded );                break;            }            else {                // Have the deployed unit load the indicated unit.                this.loadUnit( entity, loaded );            }        }        entity.setPosition(coords);        entity.setFacing(nFacing);        entity.setSecondaryFacing(nFacing);        if(entity instanceof VTOL) {            //we should let players pick, but this simplifies a lot.            ((VTOL)entity).setElevation(game.getBoard().getHex(coords).ceiling()-game.getBoard().getHex(coords).floor()+1);        }        entity.setDone(true);        entity.setDeployed(true);        entityUpdate(entity.getId());    }