Fixed a bug that Free For All multiplayer games were never finished because no player got wins. Only losses were set.

This commit is contained in:
LevelX2 2013-04-10 01:10:03 +02:00
parent 6e696c57ec
commit fe051b5d29
2 changed files with 10 additions and 1 deletions

View file

@ -392,6 +392,11 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
}
}
if (remainingPlayers <= 1 || numLosers >= state.getPlayers().size() - 1) {
for (Player player: state.getPlayers().values()) {
if (!player.hasLeft() && !player.hasLost()) {
player.won(this);
}
}
state.endGame();
endTime = new Date();
return true;

View file

@ -1158,9 +1158,13 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
//20100423 - 800.6, 801.16
if (game.getPlayers().size() > 2) {
for (UUID opponentId: game.getOpponents(playerId)) {
Player opponent = game.getPlayer(opponentId);
if (!opponent.hasLost()) {
game.getPlayer(opponentId).lost(game);
}
}
this.wins = true;
}
else {
this.wins = true;
game.end();