Better temporary fix for off-turn move on checkmate.

This commit is contained in:
yukirij 2024-12-21 12:19:30 -08:00
parent 7a508a58d7
commit 7a28de3744

View File

@ -457,7 +457,6 @@ GAME.Game = class {
movement_tiles(piece, tile) {
let tiles = [ ];
if(this.state.code != 0) { return tiles; }
let moves = piece.moves();
let hex = this.board.tiles[tile].hex;
@ -478,7 +477,7 @@ GAME.Game = class {
if((dir_mask & 0xFFF) == 0) { dir_mask >>= 12; }
// Get initial status in direction.
let valid = true;
let valid = this.state.code == 0;
let pieces_blocking = 0;
let move_hex = hex.copy();
@ -617,7 +616,6 @@ GAME.Game = class {
movement_tiles_alt(piece) {
let tiles = [ ];
if(this.state.code != 0) { return tiles; }
if(piece.promoted) {
let hex = this.board.tiles[piece.tile].hex;
@ -802,7 +800,7 @@ GAME.Game = class {
}
// Piece must have movements and not put king in check.
if(position_valid && movements.length > 0 && !checking) {
if(this.state.code == 0 && position_valid && movements.length > 0 && !checking) {
valid = true;
}
}