From c7ec4d9c64a4a93fdfb9ac35d01003ac16179355 Mon Sep 17 00:00:00 2001 From: drdev Date: Thu, 25 Sep 2014 10:02:59 +0000 Subject: [PATCH] Fix crash when starting AI v. AI match --- forge-gui/src/main/java/forge/match/MatchUtil.java | 4 ++-- .../java/forge/match/input/InputPlaybackControl.java | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/forge-gui/src/main/java/forge/match/MatchUtil.java b/forge-gui/src/main/java/forge/match/MatchUtil.java index 3aa6c2e46d6..51fef5782ad 100644 --- a/forge-gui/src/main/java/forge/match/MatchUtil.java +++ b/forge-gui/src/main/java/forge/match/MatchUtil.java @@ -193,14 +193,14 @@ public class MatchUtil { } } + controller.openView(sortedPlayers, humanCount); + if (humanCount == 0) { playbackControl = new FControlGamePlayback(GuiBase.getInterface(), getGameView()); playbackControl.setGame(game); game.subscribeToEvents(playbackControl); } - controller.openView(sortedPlayers, humanCount); - // It's important to run match in a different thread to allow GUI inputs to be invoked from inside game. // Game is set on pause while gui player takes decisions game.getAction().invoke(new Runnable() { diff --git a/forge-gui/src/main/java/forge/match/input/InputPlaybackControl.java b/forge-gui/src/main/java/forge/match/input/InputPlaybackControl.java index 10545c7de86..a83eeca0f61 100644 --- a/forge-gui/src/main/java/forge/match/input/InputPlaybackControl.java +++ b/forge-gui/src/main/java/forge/match/input/InputPlaybackControl.java @@ -4,6 +4,9 @@ import forge.control.FControlGamePlayback; import forge.game.Game; import forge.game.phase.PhaseHandler; import forge.interfaces.IGuiBase; +import forge.match.MatchUtil; +import forge.view.LocalGameView; +import forge.view.PlayerView; public class InputPlaybackControl extends InputSyncronizedBase implements InputSynchronized { private static final long serialVersionUID = 7979208993306642072L; @@ -23,6 +26,14 @@ public class InputPlaybackControl extends InputSyncronizedBase implements InputS setPause(false); } + @Override + public LocalGameView getGameView() { + return MatchUtil.getGameView(); + } + @Override + public PlayerView getOwner() { + return getGameView().getLocalPlayerView(); + } @Override public IGuiBase getGui() { return gui;