prevent selection of pieces with no legal moves
This commit is contained in:
parent
2171bb00ee
commit
db5f56735b
|
|
@ -210,6 +210,11 @@ $(function (){
|
||||||
$('#cb_board .cb-square').off('click.select');
|
$('#cb_board .cb-square').off('click.select');
|
||||||
clicked.parent().on('click.unselect', squareClickUnselect);
|
clicked.parent().on('click.unselect', squareClickUnselect);
|
||||||
pieceStartMove(clicked, 'click');
|
pieceStartMove(clicked, 'click');
|
||||||
|
|
||||||
|
if ($('#cb_board .cb-legal').length < 1) {
|
||||||
|
/* cancel the selection since there is nowhere to move the piece to */
|
||||||
|
renderBoard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pieceStartDrag(ev, ui) {
|
function pieceStartDrag(ev, ui) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue