final int playerId = (null == entityUsed) ?
final int playerId = null == entityUsed ?
    private void endCurrentTurn(Entity entityUsed) {        // Enforce "inf_move_multi" and "protos_move_multi" options.        // The "isNormalTurn" flag is checking to see if any non-Infantry        // or non-Protomech units can move during the current turn.        boolean turnsChanged = false;        GameTurn turn = game.getTurn();        final int playerId = (null == entityUsed) ?            Player.PLAYER_NONE : entityUsed.getOwnerId();        boolean infMoved = entityUsed instanceof Infantry;        boolean infMoveMulti =            game.getOptions().booleanOption("inf_move_multi")            && (game.getPhase() == IGame.PHASE_MOVEMENT                || game.getPhase() == IGame.PHASE_INITIATIVE);        boolean protosMoved = entityUsed instanceof Protomech;        boolean protosMoveMulti =            game.getOptions().booleanOption("protos_move_multi");        // If infantry or protos move multi see if any        // other unit types can move in the current turn.        int multiMask = 0;        if ( infMoveMulti ) {            multiMask += GameTurn.CLASS_INFANTRY;        }        if ( protosMoveMulti ) {            multiMask += GameTurn.CLASS_PROTOMECH;        }        // If a proto declared fire and protos don't move        // multi, ignore whether infantry move or not.        else if ( protosMoved && game.getPhase() == IGame.PHASE_FIRING ) {            multiMask = 0;        }        // Is this a general move turn?        boolean isGeneralMoveTurn =            ( !(turn instanceof GameTurn.SpecificEntityTurn) &&              !(turn instanceof GameTurn.UnitNumberTurn) &&              !(turn instanceof GameTurn.UnloadStrandedTurn) &&              ( !(turn instanceof GameTurn.EntityClassTurn) ||                ( (turn instanceof GameTurn.EntityClassTurn) &&                  ( (GameTurn.EntityClassTurn) turn ).isValidClass(~multiMask)                  )                )              );        // Unless overridden by the "protos_move_multi" option, all Protomechs        // in a unit declare fire, and they don't mix with infantry.        if ( protosMoved && !protosMoveMulti && isGeneralMoveTurn &&             game.getPhase() == IGame.PHASE_FIRING ) {            // What's the unit number and ID of the entity used?            final char movingUnit = entityUsed.getUnitNumber();            final int movingId = entityUsed.getId();            // How many other Protomechs are in the unit that can fire?            int protoTurns = game.getSelectedEntityCount                ( new EntitySelector() {                        private final int ownerId = playerId;                        private final int entityId = movingId;                        private final char unitNum = movingUnit;                        public boolean accept( Entity entity ) {                            if ( entity instanceof Protomech &&                                 entity.isSelectableThisTurn() &&                                 ownerId == entity.getOwnerId() &&                                 entityId != entity.getId() &&                                 unitNum == entity.getUnitNumber() )                                return true;                            return false;                        }                    } );            // Add the correct number of turns for the Protomech unit number.            for (int i = 0; i < protoTurns; i++) {                GameTurn newTurn = new GameTurn.UnitNumberTurn                    ( playerId, movingUnit );                game.insertNextTurn(newTurn);                turnsChanged = true;            }        }        // Otherwise, we may need to add turns for the "*_move_multi" options.        else if ( ( (infMoved && infMoveMulti) ||                    (protosMoved && protosMoveMulti) ) &&                  isGeneralMoveTurn ) {            int remaining = 0;            // Calculate the number of EntityClassTurns need to be added.            if ( infMoveMulti ) {                remaining += game.getInfantryLeft(playerId);            }            if ( protosMoveMulti ) {                remaining += game.getProtomechsLeft(playerId);            }            int moreInfAndProtoTurns =                Math.min(game.getOptions().intOption("inf_proto_move_multi") - 1, remaining);            // Add the correct number of turns for the right unit classes.            for (int i = 0; i < moreInfAndProtoTurns; i++) {                GameTurn newTurn =                    new GameTurn.EntityClassTurn( playerId, multiMask );                game.insertNextTurn(newTurn);                turnsChanged = true;            }        }        // brief everybody on the turn update, if they changed        if (turnsChanged) {            send(createTurnVectorPacket());        }        // move along        changeToNextTurn();    }