/**
* Place the stone on the board.
*/
private void processStonePlacement(Location loc, GoMove m, GoBoardPosition stone) {
GoController controller = (GoController) viewer_.getController();
GoBoard board = (GoBoard) controller.getBoard();
boolean player1sTurn = controller.isPlayer1sTurn();
if ( stone.isOccupied() ) {
JOptionPane.showMessageDialog( null, GameContext.getLabel("CANT_PLAY_ON_STONE") );
GameContext.log( 0, "BoardViewer: There is already a stone there: " + stone );
return;
}
if ( GoMoveGenerator.isTakeBack(m.getToRow(), m.getToCol(), (GoMove) controller.getLastMove(), board) ) {
JOptionPane.showMessageDialog( null, GameContext.getLabel("NO_TAKEBACKS"));
return;
}
assert(!stone.isVisited());
if (m.isSuicidal(board)) {
JOptionPane.showMessageDialog( null, GameContext.getLabel("SUICIDAL") );
GameContext.log( 1, "BoardViewer: That move is suicidal (and hence illegal): " + stone );
return;
}
if ( !((AbstractTwoPlayerBoardViewer)viewer_).continuePlay( m ) ) { // then game over
getRenderer().setDraggedShowPiece(null);
}
else if (controller.getPlayers().allPlayersHuman()) {
// create a stone to show for the next players move
getRenderer().setDraggedShowPiece(
new GoBoardPosition(loc.getRow(), loc.getCol(), null, new GoStone(!player1sTurn)));
}
}