if (infAndProtosLast) { turn = new GameTurn.NotInfantryOrProtomechTurn(p.getId()); } else { turn = new GameTurn(p.getId());
else if ( infMoveLast || protosMoveLast ) { turn = new GameTurn.EntityClassTurn(player.getId(), ~lastMask); }   else { turn = new GameTurn( player.getId() );
    private void determineTurnOrder(int phase) {        // Reset all of the turn counts        for (Enumeration i = game.getPlayers(); i.hasMoreElements();) {            final Player player = (Player)i.nextElement();            player.resetTankCount();            player.resetInfantryAndProtomechCount();            player.resetMechCount();        }        // Go through all entities, and update the player objects        for (Enumeration e = game.getEntities(); e.hasMoreElements();) {            final Entity entity = (Entity)e.nextElement();            if (entity.isSelectableThisTurn(game)) {                final Player player = entity.getOwner();                if ( entity instanceof Infantry ||                     entity instanceof Protomech)                    player.incrementInfantryAndProtomechCount();                else if (entity instanceof Tank )                    player.incrementTankCount();                else                    player.incrementMechCount();            }        }        // Go through each team, update the turn count,        // and then generate the team order on each team.        //  This boolean determines whether infantry/protos move and/or        //   deploy last according to game options.        boolean infAndProtosLast = game.getOptions().booleanOption("inf_and_protos_move_last") && (game.getPhase() != Game.PHASE_DEPLOYMENT || game.getOptions().booleanOption("inf_and_protos_deploy_last"));        TurnVectors team_order;        for (Enumeration t = game.getTeams(); t.hasMoreElements(); ) {            final Team team = (Team)t.nextElement();            team.updateTurnCount();            team.determineTeamOrder(infAndProtosLast);        }        // Now, generate the order that the teams go in        team_order = TurnOrdered.generateTurnOrder(game.getTeamsVector(),                                                   infAndProtosLast);        // Now, we have the order that the teams        // go in, and the order team goes in.        Vector turns = new Vector(team_order.infantry_and_protomechs.size() +                                  team_order.non_infantry_non_protomechs.size() );        // First, the non infantry/protomechs.  We will do this by looking at        // first element on the team_order vector, then looking at        // the first element on THAT team's order list.  We will create        // a new turn, then remove the entry from the team's order list and        // the uber-turn-order list here.        while ( !team_order.non_infantry_non_protomechs.isEmpty() ) {            GameTurn turn = null;            Team t = (Team)team_order.non_infantry_non_protomechs.firstElement();            Player p = (Player)t.getTurnOrder().non_infantry_non_protomechs.firstElement();            if (infAndProtosLast) {                turn = new GameTurn.NotInfantryOrProtomechTurn(p.getId());            } else {                turn = new GameTurn(p.getId());            }            turns.addElement(turn);            // Now, remove the entry            t.getTurnOrder().non_infantry_non_protomechs.removeElement(p);            team_order.non_infantry_non_protomechs.removeElement(t);        }        // Now, repeat for the infantry and protomechs        while ( !team_order.infantry_and_protomechs.isEmpty() ) {            GameTurn turn = null;            Team t = (Team)team_order.infantry_and_protomechs.firstElement();            Player p = (Player)t.getTurnOrder().infantry_and_protomechs.firstElement();            turn = new GameTurn.OnlyInfantryAndProtomechTurn(p.getId());            turns.addElement(turn);            // Now, remove the entry            t.getTurnOrder().infantry_and_protomechs.removeElement(p);            team_order.infantry_and_protomechs.removeElement(t);        }        // set fields in game        game.setTurnVector(turns);        game.resetTurnIndex();        // send turns to all players        send(createTurnVectorPacket());    }