mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
Fixed possible NPE during handling of choosing start player (Fixes #317).
This commit is contained in:
parent
8b67be6e65
commit
c6e4df60ba
1 changed files with 8 additions and 9 deletions
|
@ -624,22 +624,21 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
||||||
TargetPlayer targetPlayer = new TargetPlayer();
|
TargetPlayer targetPlayer = new TargetPlayer();
|
||||||
targetPlayer.setRequired(true);
|
targetPlayer.setRequired(true);
|
||||||
targetPlayer.setTargetName("starting player");
|
targetPlayer.setTargetName("starting player");
|
||||||
Player choosingPlayer;
|
Player choosingPlayer = null;
|
||||||
if (choosingPlayerId == null) {
|
if (choosingPlayerId != null) {
|
||||||
choosingPlayer = getPlayer(pickChoosingPlayer());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
choosingPlayer = this.getPlayer(choosingPlayerId);
|
choosingPlayer = this.getPlayer(choosingPlayerId);
|
||||||
}
|
}
|
||||||
if (choosingPlayer.choose(Outcome.Benefit, targetPlayer, null, this)) {
|
if (choosingPlayer == null) {
|
||||||
|
choosingPlayer = getPlayer(pickChoosingPlayer());
|
||||||
|
}
|
||||||
|
if (choosingPlayer != null && choosingPlayer.choose(Outcome.Benefit, targetPlayer, null, this)) {
|
||||||
startingPlayerId = ((List<UUID>)targetPlayer.getTargets()).get(0);
|
startingPlayerId = ((List<UUID>)targetPlayer.getTargets()).get(0);
|
||||||
fireInformEvent(state.getPlayer(startingPlayerId).getName() + " will start");
|
fireInformEvent(state.getPlayer(startingPlayerId).getName() + " will start");
|
||||||
}
|
} else {
|
||||||
else {
|
// not possible to choose starting player, stop here
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//saveState();
|
|
||||||
|
|
||||||
//20091005 - 103.3
|
//20091005 - 103.3
|
||||||
for (UUID playerId: state.getPlayerList(startingPlayerId)) {
|
for (UUID playerId: state.getPlayerList(startingPlayerId)) {
|
||||||
|
|
Loading…
Reference in a new issue