From b4059a786029132eb27769a42ca52eca6d8b44cc Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 9 Feb 2018 20:16:46 +0100 Subject: [PATCH] Fix Chess960 bug when castling does not move the rook. --- www/js/chess.js | 10 +++++----- www/js/remoteglot.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/www/js/chess.js b/www/js/chess.js index 6d6623e..9da372c 100644 --- a/www/js/chess.js +++ b/www/js/chess.js @@ -997,14 +997,14 @@ var Chess = function(fen) { if (move.flags & BITS.KSIDE_CASTLE) { var castling_to = move.to - 1; var castling_from = move.rook_sq; - board[castling_to] = board[castling_from]; - if(castling_from !== move.to) + board[castling_to] = {type: ROOK, color: us}; + if(castling_from !== move.to && castling_from !== castling_to) board[castling_from] = null; } else if (move.flags & BITS.QSIDE_CASTLE) { var castling_to = move.to + 1; var castling_from = move.rook_sq; - board[castling_to] = board[castling_from]; - if(castling_from !== move.to) + board[castling_to] = {type: ROOK, color: us}; + if(castling_from !== move.to && castling_from !== castling_to) board[castling_from] = null; } @@ -1105,7 +1105,7 @@ var Chess = function(fen) { } board[castling_to] = board[castling_from]; - if(castling_from !== move.from) + if(castling_from !== move.from && castling_from !== castling_to) board[castling_from] = null; } diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index f6c06bb..b3b8163 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -7,7 +7,7 @@ * @type {Number} * @const * @private */ -var SCRIPT_VERSION = 2016113002; +var SCRIPT_VERSION = 2016113007; /** * The current backend URL. -- 2.39.2