// we don't show dialogs if both players are computers.
if (get2PlayerController().getPlayers().allPlayersComputer())
return;
int row, col;
ChessBoard b = (ChessBoard)controller_.getBoard();
boolean checked = false;
for ( row = 1; row <= b.getNumRows(); row++ ) {
for ( col = 1; col <= b.getNumCols(); col++ ) {
BoardPosition pos = b.getPosition( row, col );
assert (pos != null) : "pos at row="+row+" col="+col +" is null";
if ( pos.isOccupied() && pos.getPiece().isOwnedByPlayer1() == m.isPlayer1() ) {
// @@ second arg is not technically correct. it should be last move, but I don't think it matters.
checked = b.isKingCheckedByPosition(pos, m);
}
if (checked) {
JOptionPane.showMessageDialog( this,
GameContext.getLabel("KING_IN_CHECK"), GameContext.getLabel("INFORMATION"), JOptionPane.INFORMATION_MESSAGE );
return;