From d86848863369a5e34f5c85e503d45a014f32ff5e Mon Sep 17 00:00:00 2001 From: Damian Hofmann Date: Sun, 7 Jun 2020 02:32:13 +0200 Subject: [PATCH] Chess: Fix short-castling for black In the code for black short-castling, the presence of rook_black_2 was checked on the wrong field (1 instead of 8), which prevents black from short-castling. (This was probably overlooked when copying the logic from the long-castling check directly above.) --- src/chess.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chess.lua b/src/chess.lua index a1364da..be7fc96 100644 --- a/src/chess.lua +++ b/src/chess.lua @@ -1147,7 +1147,7 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, _, player end elseif to_x == 6 then local castlingBlackR = meta:get_int("castlingBlackR") - local idx8 = inv:get_stack(from_list, 1):get_name() + local idx8 = inv:get_stack(from_list, 8):get_name() if castlingBlackR == 1 and idx8 == "realchess:rook_black_2" then for i = from_index + 1, 7 do -- 2.44.0