when moving the king or castling remove the ability to castle - chess-puzzles -… | |
git clone git://git.codemadness.org/chess-puzzles | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit aaac499d48085948814415956d3eb4ded33eb704 | |
parent dab21427a28e5561843d56cb4de324cddd4c53c7 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Wed, 20 Dec 2023 19:26:30 +0100 | |
when moving the king or castling remove the ability to castle | |
+ a pedantic ctype fix. | |
Diffstat: | |
M fen_to_svg.c | 6 +++++- | |
1 file changed, 5 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/fen_to_svg.c b/fen_to_svg.c | |
@@ -559,6 +559,8 @@ main(int argc, char *argv[]) | |
y2 = 7; | |
place(0, x2, y2); | |
} | |
+ /* remove the ability to castle */ | |
+ white_can_castle[0] = white_can_castle[1] = 0; | |
} else if (piece == 'k' && y == 0 && y2 == 0 && x == 4… | |
/* black: kingside castling: "e8g8" */ | |
if (x2 == 6) { | |
@@ -573,12 +575,14 @@ main(int argc, char *argv[]) | |
y2 = 0; | |
place(0, x2, y2); /* clear rook square… | |
} | |
+ /* remove the ability to castle */ | |
+ black_can_castle[0] = black_can_castle[1] = 0; | |
} | |
/* possible promotion: queen, knight, bishop */ | |
if (*s == 'q' || *s == 'n' || *s == 'b') { | |
if (side_to_move == 'w') | |
- piece = toupper(*s); | |
+ piece = toupper((unsigned char)*s); | |
else | |
piece = *s; | |
place(piece, x2, y2); |