if(getType() == MovePath.STEP_DFA) { setElevation(1 + Math.max(entity.elevationOccupied(game.getBoard().getHex(prev.getPosition())), entity.elevationOccupied(game.getBoard().getHex(getPosition()))));
if (getType() == MovePath.STEP_DFA) { IHex hex = game.getBoard().getHex(getPosition()); setElevation(Math.max(0, hex.terrainLevel(Terrains.BLDG_ELEV)));   int otherEl = 0; IHex hex2 = game.getBoard().getHex(prev.getPosition()); otherEl = Math.max(0, hex2.terrainLevel(Terrains.BLDG_ELEV)); if (otherEl > getElevation()) setElevation(otherEl); setElevation(getElevation() + 1);
    private void compileMove(final IGame game, final Entity entity, MoveStep prev) {        IHex destHex = game.getBoard().getHex(getPosition());        // Check for pavement movement.        if (Compute.canMoveOnPavement(game, prev.getPosition(),                                      getPosition())) {            setPavementStep(true);        } else {            setPavementStep(false);            setOnlyPavement(false);        }        setHasJustStood(false);        if (prev.isThisStepBackwards() != isThisStepBackwards()) {            setDistance(0); //start over after shifting gears        }        addDistance(1);        if(getType() == MovePath.STEP_DFA) {            setElevation(1 + Math.max(entity.elevationOccupied(game.getBoard().getHex(prev.getPosition())), entity.elevationOccupied(game.getBoard().getHex(getPosition()))));        } else if (parent.isJumping()) {            IHex hex = game.getBoard().getHex(getPosition());            int maxElevation = entity.getJumpMP() + entity.getElevation() + game.getBoard().getHex(entity.getPosition()).surface() - hex.surface();            int building = hex.terrainLevel(Terrains.BLDG_ELEV);            if(entity instanceof Infantry) {                //infantry can jump into a building                setElevation(Math.max(-hex.depth(), Math.min(building,maxElevation)));            } else {                setElevation(Math.max(-hex.depth(), building));            }            if(climbMode() && maxElevation >= hex.terrainLevel(Terrains.BRIDGE_ELEV)) {                setElevation(Math.max(getElevation(), hex.terrainLevel(Terrains.BRIDGE_ELEV)));            }        } else {            setElevation(entity.calcElevation(game.getBoard().getHex(prev.getPosition()),game.getBoard().getHex(getPosition()),elevation, climbMode()));        }        calcMovementCostFor(game, prev.getPosition(), prev.getElevation());        // check for water        if (!isPavementStep()                && destHex.terrainLevel(Terrains.WATER) > 0                && !(destHex.containsTerrain(Terrains.ICE) && elevation >= 0)                && !(destHex.terrainLevel(Terrains.BRIDGE_ELEV) == elevation)                && entity.getMovementMode() != IEntityMovementMode.HOVER                && entity.getMovementMode() != IEntityMovementMode.NAVAL                && entity.getMovementMode() != IEntityMovementMode.HYDROFOIL                && !(elevation == 0 && entity.getMovementMode() == IEntityMovementMode.SUBMARINE) //sub can't flank underwater                && entity.getMovementMode() != IEntityMovementMode.VTOL) {            setRunProhibited(true);        }        int magmaLevel = destHex.terrainLevel(Terrains.MAGMA);        if(elevation > 0) {            magmaLevel = 0;        }        // Check for fire or magma crust in the new hex.        if (destHex.containsTerrain(Terrains.FIRE) || magmaLevel == 1) {            heat = 2;            totalHeat += 2;        }        // Check for liquid magma        else if(magmaLevel == 2) {            heat = 5;            totalHeat += 5;        }    }