minetest-mods / xdecor

A decoration mod for Minetest meant to be light, simple and well-featured
Other
29 stars 45 forks source link

Chess: Fix queen-side castling and king-side castling for black #121

Closed femtobit closed 4 years ago

femtobit commented 4 years ago

In the code for black short-castling, the presence of rook_black_2 is checked on the wrong field (1 instead of 8, where rook_black_1 is placed initially), which prevents black from short-castling. (This was probably overlooked when copying the logic from the long-castling check directly above.)

After making this change, so that idx8 indeed refers to the figure on field 8, castling indeed works as expected.

Edit: And while we're at it, as issue #120 points out, the king should move two squares towards the rook when queen-side castling. This is now fixed in the second commit.