diff --git a/game/src/lib.rs b/game/src/lib.rs index f57e817..d6e6834 100644 --- a/game/src/lib.rs +++ b/game/src/lib.rs @@ -752,17 +752,13 @@ 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() { - valid = false; - break; - } + if (flags & flags::IGNORE_CHECK as u32) == 0 { + for mv in piece_moves { + if mv.valid && mv.check.is_check() { + valid = false; + break; } } - } else { - valid = false; } valid diff --git a/www/js/game.js b/www/js/game.js index 338a214..dcfbb17 100644 --- a/www/js/game.js +++ b/www/js/game.js @@ -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; } }