Fixed frozen game after adding a new one
This commit is contained in:
parent
15fc153dac
commit
00eea6d863
@ -38,7 +38,9 @@ public class MenuBar extends JMenuBar {
|
|||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
if (dialog.isStartGame()) {
|
if (dialog.isStartGame()) {
|
||||||
GamePane gamePane = mainWindow.addGamePane();
|
GamePane gamePane = mainWindow.addGamePane();
|
||||||
gamePane.setGame(new Game(gamePane.getBoardPane(), dialog.getWhiteName(), dialog.getBlackName()));
|
Game game = new Game(gamePane.getBoardPane(), dialog.getWhiteName(), dialog.getBlackName());
|
||||||
|
gamePane.setGame(game);
|
||||||
|
game.start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
gameMenu.add(newGameMenuItem);
|
gameMenu.add(newGameMenuItem);
|
||||||
@ -56,7 +58,8 @@ public class MenuBar extends JMenuBar {
|
|||||||
JMenuItem addEngineMenuItem = new JMenuItem("Add engine");
|
JMenuItem addEngineMenuItem = new JMenuItem("Add engine");
|
||||||
addEngineMenuItem.addActionListener((evt) -> {
|
addEngineMenuItem.addActionListener((evt) -> {
|
||||||
String enginePath = JOptionPane.showInputDialog(getParent(),
|
String enginePath = JOptionPane.showInputDialog(getParent(),
|
||||||
"Enter the path to a UCI-compatible chess engine:", "Engine selection",
|
"Enter the path to a UCI-compatible chess engine:",
|
||||||
|
"Engine selection",
|
||||||
JOptionPane.QUESTION_MESSAGE);
|
JOptionPane.QUESTION_MESSAGE);
|
||||||
if (enginePath != null) EngineUtil.addEngine(enginePath);
|
if (enginePath != null) EngineUtil.addEngine(enginePath);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user