From 7a28de374456aed4a793ef7bb8b6d010dff2fde2 Mon Sep 17 00:00:00 2001 From: yukirij Date: Sat, 21 Dec 2024 12:19:30 -0800 Subject: [PATCH] Better temporary fix for off-turn move on checkmate. --- www/js/game.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/www/js/game.js b/www/js/game.js index d9abe78..338a214 100644 --- a/www/js/game.js +++ b/www/js/game.js @@ -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; } }