X-Git-Url: https://git.auder.net/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fbase_rules.js;h=d35a91865eeb5f0eed7b5a140599817a62732594;hb=616561273f216debfeab7f5fc532d0b0a8bc8e2d;hp=d1348e71927b6bdf410659395bd5e3715f1f5372;hpb=0a9cef131612079e55714f56f1466b4e2bd749af;p=vchess.git diff --git a/client/src/base_rules.js b/client/src/base_rules.js index d1348e71..d35a9186 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -86,6 +86,11 @@ export const ChessRules = class ChessRules { return V.CanFlip; } + // Some variants use click infos: + doClick() { + return null; + } + static get IMAGE_EXTENSION() { // All pieces should be in the SVG format return ".svg"; @@ -846,12 +851,12 @@ export const ChessRules = class ChessRules { // NOTE: in some variants this is not a rook const rookPos = this.castleFlags[c][castleSide]; - const castlingPiece = this.getPiece(x, rookPos); - if (this.getColor(x, rookPos) != c) - // Rook is here but changed color (see Benedict) + if (this.board[x][rookPos] == V.EMPTY || this.getColor(x, rookPos) != c) + // Rook is not here, or changed color (see Benedict) continue; // Nothing on the path of the king ? (and no checks) + const castlingPiece = this.getPiece(x, rookPos); const finDist = finalSquares[castleSide][0] - y; let step = finDist / Math.max(1, Math.abs(finDist)); i = y;