diff --git a/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java b/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java index 68e02f18ee8..fe039a09176 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java +++ b/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java @@ -608,12 +608,12 @@ public enum CMatchUI implements ICDoc, IMenuProvider, IMatchController { } @Override - public void openView(List sortedPlayers, int humanCount) { + public void openView(List sortedPlayers) { List sortedPlayerViews = new ArrayList(); for (Player p : sortedPlayers) { sortedPlayerViews.add(MatchUtil.getGameView().getPlayerView(p)); } - CMatchUI.SINGLETON_INSTANCE.initMatch(sortedPlayerViews, humanCount != 1); + CMatchUI.SINGLETON_INSTANCE.initMatch(sortedPlayerViews, MatchUtil.getHumanCount() != 1); actuateMatchPreferences(); @@ -622,7 +622,7 @@ public enum CMatchUI implements ICDoc, IMenuProvider, IMatchController { // per player observers were set in CMatchUI.SINGLETON_INSTANCE.initMatch //Set Field shown to current player. - if (humanCount > 0) { + if (MatchUtil.getHumanCount() > 0) { final VField nextField = CMatchUI.SINGLETON_INSTANCE.getFieldViewFor(sortedPlayerViews.get(0)); SDisplayUtil.showTab(nextField); } diff --git a/forge-gui-mobile/src/forge/screens/match/MatchController.java b/forge-gui-mobile/src/forge/screens/match/MatchController.java index 9d11a88f517..926919059f3 100644 --- a/forge-gui-mobile/src/forge/screens/match/MatchController.java +++ b/forge-gui-mobile/src/forge/screens/match/MatchController.java @@ -124,14 +124,15 @@ public class MatchController implements IMatchController { } @Override - public void openView(List sortedPlayers, int humanCount) { + public void openView(List sortedPlayers) { + boolean noHumans = MatchUtil.getHumanCount() == 0; List playerPanels = new ArrayList(); for (Player p : sortedPlayers) { - playerPanels.add(new VPlayerPanel(MatchUtil.getGameView(p).getPlayerView(p), humanCount == 0 || p.getController() instanceof PlayerControllerHuman)); + playerPanels.add(new VPlayerPanel(MatchUtil.getGameView(p).getPlayerView(p), noHumans || p.getController() instanceof PlayerControllerHuman)); } view = new MatchScreen(playerPanels); - if (humanCount == 0) { + if (noHumans) { //add special object that pauses game if screen touched view.add(new FDisplayObject() { @Override diff --git a/forge-gui-mobile/src/forge/screens/match/MatchScreen.java b/forge-gui-mobile/src/forge/screens/match/MatchScreen.java index 51845deac70..a87d70261ac 100644 --- a/forge-gui-mobile/src/forge/screens/match/MatchScreen.java +++ b/forge-gui-mobile/src/forge/screens/match/MatchScreen.java @@ -16,7 +16,6 @@ import forge.game.zone.ZoneType; import forge.match.MatchUtil; import forge.menu.FMenuBar; import forge.model.FModel; -import forge.player.LobbyPlayerHuman; import forge.properties.ForgePreferences; import forge.properties.ForgePreferences.FPref; import forge.screens.FScreen; @@ -66,12 +65,8 @@ public class MatchScreen extends FScreen { scroller = add(new FieldScroller()); - int humanCount = 0; for (VPlayerPanel playerPanel : playerPanels0) { playerPanels.put(playerPanel.getPlayer(), scroller.add(playerPanel)); - if (playerPanel.getPlayer().getLobbyPlayer() instanceof LobbyPlayerHuman) { - humanCount++; - } } bottomPlayerPanel = playerPanels0.get(0); topPlayerPanel = playerPanels0.get(1); @@ -91,7 +86,7 @@ public class MatchScreen extends FScreen { } })); - if (humanCount > 1) { //show top prompt if multiple human players + if (MatchUtil.getHumanCount() > 1) { //show top prompt if multiple human players topPlayerPrompt = add(new VPrompt("", "", new FEventHandler() { @Override diff --git a/forge-gui/src/main/java/forge/match/IMatchController.java b/forge-gui/src/main/java/forge/match/IMatchController.java index a22e8fd4030..f296f4bf4c2 100644 --- a/forge-gui/src/main/java/forge/match/IMatchController.java +++ b/forge-gui/src/main/java/forge/match/IMatchController.java @@ -22,7 +22,7 @@ import forge.view.SpellAbilityView; public interface IMatchController { void startNewMatch(Match match); boolean resetForNewGame(); - void openView(List sortedPlayers, int humanCount); + void openView(List sortedPlayers); void afterGameEnd(); void showCombat(CombatView combat); void showPromptMessage(PlayerView playerView, String message); diff --git a/forge-gui/src/main/java/forge/match/MatchUtil.java b/forge-gui/src/main/java/forge/match/MatchUtil.java index 805e9c28d8e..ec44aac8ef7 100644 --- a/forge-gui/src/main/java/forge/match/MatchUtil.java +++ b/forge-gui/src/main/java/forge/match/MatchUtil.java @@ -194,7 +194,7 @@ public class MatchUtil { } } - controller.openView(sortedPlayers, humanCount); + controller.openView(sortedPlayers); if (humanCount == 0) { playbackControl = new FControlGamePlayback(GuiBase.getInterface(), getGameView());