]> git.lizzy.rs Git - xdecor.git/commitdiff
Chess: Fix short-castling for black
authorDamian Hofmann <femtobit@users.noreply.github.com>
Sun, 7 Jun 2020 00:32:13 +0000 (02:32 +0200)
committerJean-Patrick Guerrero <kilbith@users.noreply.github.com>
Wed, 24 Jun 2020 16:31:30 +0000 (18:31 +0200)
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

index a1364da8497906f4fbdc3cea10b223fcccf66ed9..be7fc96ad9d4e8f25c0152185972d02c3c954ecc 100644 (file)
@@ -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