Allow drops without valid moves.
This commit is contained in:
parent
c107eb35ff
commit
3df4224448
@ -752,7 +752,6 @@ impl Game {
|
||||
** A piece may not be dropped onto a position that puts the opposing king in check.
|
||||
*/
|
||||
let piece_moves = self.get_moves_data(&piece);
|
||||
if piece_moves.len() > 0 {
|
||||
if (flags & flags::IGNORE_CHECK as u32) == 0 {
|
||||
for mv in piece_moves {
|
||||
if mv.valid && mv.check.is_check() {
|
||||
@ -761,9 +760,6 @@ impl Game {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
valid
|
||||
}
|
||||
|
@ -757,7 +757,7 @@ GAME.Game = class {
|
||||
let tile = this.board.tiles[tile_id];
|
||||
|
||||
// Check if tile is occupied.
|
||||
if(tile.piece === null) {
|
||||
if(tile.piece === null && this.state.code == 0) {
|
||||
let position_valid = true;
|
||||
|
||||
// Prevent placement that does not uncheck King.
|
||||
@ -800,7 +800,7 @@ GAME.Game = class {
|
||||
}
|
||||
|
||||
// Piece must have movements and not put king in check.
|
||||
if(this.state.code == 0 && position_valid && movements.length > 0 && !checking) {
|
||||
if(position_valid && !checking) {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user