md.compile(client.game, entity);
md.compileLastStep();
    private String doPSRCheck(MovePath md) {        StringBuffer nagReport = new StringBuffer();        final Entity entity = ce();        // okay, proceed with movement calculations        Coords lastPos = entity.getPosition();        Coords curPos = entity.getPosition();        int curFacing = entity.getFacing();        int distance = 0;        int moveType = Entity.MOVE_NONE;        int overallMoveType = Entity.MOVE_NONE;        boolean firstStep;        int prevFacing = curFacing;        Hex prevHex = null;        final boolean isInfantry = (entity instanceof Infantry);        PilotingRollData rollTarget;                // Compile the move        md.compile(client.game, entity);        overallMoveType = md.getLastStepMovementType();                // iterate through steps        firstStep = true;        /* Bug 754610: Revert fix for bug 702735. */        MoveStep prevStep = null;        for (final Enumeration i = md.getSteps(); i.hasMoreElements();) {            final MoveStep step = (MoveStep)i.nextElement();            boolean isPavementStep = step.isPavementStep();                        // stop for illegal movement            if (step.getMovementType() == Entity.MOVE_ILLEGAL) {                break;            }                        // check piloting skill for getting up            rollTarget = entity.checkGetUp(step);            if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {                nagReport.append(addNag(rollTarget));            } else if (firstStep) {                // running with destroyed hip or gyro needs a check                rollTarget = entity.checkRunningWithDamage(overallMoveType);                if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {                    nagReport.append(addNag(rollTarget));                }                firstStep = false;            }                        // set most step parameters            moveType = step.getMovementType();            distance = step.getDistance();             // set last step parameters            curPos = step.getPosition();            curFacing = step.getFacing();            final Hex curHex = client.game.board.getHex(curPos);            // Check for skid.            rollTarget = entity.checkSkid(moveType, prevHex, overallMoveType,                                          prevStep, prevFacing, curFacing,                                          lastPos, curPos, isInfantry,                                          distance);            if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {                // Have an entity-meaningful PSR message.                nagReport.append(addNag(rollTarget));            }            // check if we've moved into rubble            rollTarget = entity.checkRubbleMove(step, curHex, lastPos, curPos);            if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {                nagReport.append(addNag(rollTarget));            }                        // check if we've moved into water            rollTarget = entity.checkWaterMove(step, curHex, lastPos, curPos,                                               isPavementStep);            if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {                nagReport.append(addNag(rollTarget));            }            // Handle non-infantry moving into a building.            if (entity.checkMovementInBuilding(lastPos, curPos, step,                                               curHex, prevHex)) {                                // Get the building being exited.                // TODO: allow units to climb on top of buildings.                Building bldgExited = client.game.board.getBuildingAt( lastPos );                // Get the building being entered.                // TODO: allow units to climb on top of buildings.                Building bldgEntered = client.game.board.getBuildingAt( curPos );                if ( bldgExited != null && bldgEntered != null &&                      !bldgExited.equals(bldgEntered) ) {                    // Exiting one building and entering another.                    //  Brave, aren't we?                    rollTarget = entity.rollMovementInBuilding(bldgExited, distance, "exiting");                    nagReport.append(addNag(rollTarget));                    rollTarget = entity.rollMovementInBuilding(bldgEntered, distance, "entering");                    nagReport.append(addNag(rollTarget));                } else {                    Building bldg;                    if (bldgEntered == null) {                        // Exiting a building.                        bldg = bldgExited;                    } else {                        // Entering or moving within a building.                        bldg = bldgEntered;                    }                    rollTarget = entity.rollMovementInBuilding(bldg, distance, "");                    nagReport.append(addNag(rollTarget));                }            }            if (step.getType() == MovePath.STEP_GO_PRONE) {                rollTarget = entity.checkDislodgeSwarmers();                if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {                    nagReport.append(addNag(rollTarget));                }            }            // update lastPos, prevStep, prevFacing & prevHex            lastPos = new Coords(curPos);            prevStep = step;            /* Bug 754610: Revert fix for bug 702735.            if (prevHex != null && !curHex.equals(prevHex)) {            */            if (!curHex.equals(prevHex)) {                prevFacing = curFacing;            }            prevHex = curHex;        }                // but the danger isn't over yet!  landing from a jump can be risky!        if (overallMoveType == Entity.MOVE_JUMP && !entity.isMakingDfa()) {            // check for damaged criticals            rollTarget = entity.checkLandingWithDamage();            if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {                nagReport.append(addNag(rollTarget));            }            // jumped into water?            int waterLevel = client.game.board.getHex(curPos).levelOf(Terrain.WATER);            rollTarget = entity.checkWaterMove(waterLevel);            if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {                nagReport.append(addNag(rollTarget));            }        }                return nagReport.toString();    }