- Fix for Players not being assigned to any team causing issues from Quest mode

This commit is contained in:
Sol
2014-02-18 03:04:40 +00:00
parent 07915701c3
commit 5e3786fe1c

View File

@@ -86,6 +86,14 @@ public class Game {
allPlayers = Collections.unmodifiableList(players); allPlayers = Collections.unmodifiableList(players);
roIngamePlayers = Collections.unmodifiableList(ingamePlayers); roIngamePlayers = Collections.unmodifiableList(ingamePlayers);
int highestTeam = -1;
for (RegisteredPlayer psc : players0) {
// Track highest team number for auto assigning unassigned teams
int teamNum = psc.getTeamNumber();
if (teamNum > highestTeam)
highestTeam = teamNum;
}
for (RegisteredPlayer psc : players0) { for (RegisteredPlayer psc : players0) {
Player pl = psc.getPlayer().createIngamePlayer(this); Player pl = psc.getPlayer().createIngamePlayer(this);
players.add(pl); players.add(pl);
@@ -94,7 +102,15 @@ public class Game {
pl.setStartingLife(psc.getStartingLife()); pl.setStartingLife(psc.getStartingLife());
pl.setMaxHandSize(psc.getStartingHand()); pl.setMaxHandSize(psc.getStartingHand());
pl.setStartingHandSize(psc.getStartingHand()); pl.setStartingHandSize(psc.getStartingHand());
pl.setTeam(psc.getTeamNumber());
int teamNum = psc.getTeamNumber();
if (teamNum == -1) {
// RegisteredPlayer doesn't have an assigned team, set it to 1 higher than the highest found team number
teamNum = ++highestTeam;
psc.setTeamNumber(teamNum);
}
pl.setTeam(teamNum);
} }
action = new GameAction(this); action = new GameAction(this);