Allow Human vs Human games in GUI refactoring, plus some minor fixes.

This commit is contained in:
elcnesh
2014-09-12 13:06:54 +00:00
parent c3e9ff7e5b
commit 22374664f7
4 changed files with 74 additions and 5 deletions

View File

@@ -449,6 +449,14 @@ public enum FControl implements KeyEventDispatcher {
this.game = match.createGame();
inputQueue = new InputQueue(game);
boolean anyPlayerIsAi = false;
for (final Player p : game.getPlayers()) {
if (p.getLobbyPlayer() instanceof LobbyPlayerAi) {
anyPlayerIsAi = true;
break;
}
}
final LobbyPlayer me = getGuiPlayer();
for (final Player p : game.getPlayers()) {
if (p.getLobbyPlayer().equals(me)) {
@@ -459,6 +467,17 @@ public enum FControl implements KeyEventDispatcher {
}
}
if (!anyPlayerIsAi) {
// If there are no AI's, allow all players to see all cards (hotseat
// mode).
for (final Player p : game.getPlayers()) {
if (p.getController() instanceof PlayerControllerHuman) {
final PlayerControllerHuman controller = (PlayerControllerHuman) p.getController();
controller.setMayLookAtAllCards(true);
}
}
}
if (this.gameView == null) {
// Watch game but do not participate
final LocalGameView gameView = new LocalGameView(game);