Fix crash when starting AI v. AI match

This commit is contained in:
drdev
2014-09-25 10:02:59 +00:00
parent a76c9f25fd
commit c7ec4d9c64
2 changed files with 13 additions and 2 deletions

View File

@@ -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() {

View File

@@ -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;