aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/movecheck.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-05-05 17:03:42 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-05-05 17:03:42 +0200
commit1c3425cd269513944b1ccbe3591644009c3c30b5 (patch)
treef07ab68f8a2468abc117e44262b553bb838ff9a3 /FICS/movecheck.c
parentdfd1b35e80c6d17c238327bd61c46c3af3c65b8f (diff)
Reformatted possible_king_moves()
Diffstat (limited to 'FICS/movecheck.c')
-rw-r--r--FICS/movecheck.c49
1 files changed, 30 insertions, 19 deletions
diff --git a/FICS/movecheck.c b/FICS/movecheck.c
index df13cd5..66be5d1 100644
--- a/FICS/movecheck.c
+++ b/FICS/movecheck.c
@@ -568,26 +568,37 @@ PRIVATE void possible_queen_moves(game_state_t * gs,
possible_bishop_moves(gs, onf, onr, posf, posr, numpos);
}
-PRIVATE void possible_king_moves(game_state_t * gs,
- int onf, int onr,
- int *posf, int *posr, int *numpos)
+PRIVATE void
+possible_king_moves(game_state_t *gs,
+ int onf, int onr,
+ int *posf, int *posr,
+ int *numpos)
{
- static int kingJumps[8][2] = {{-1, -1}, {0, -1}, {1, -1}, {-1, 1},
- {0, 1}, {1, 1}, {-1, 0}, {1, 0}};
- int f, r;
- int j;
-
- for (j = 0; j < 8; j++) {
- f = kingJumps[j][0] + onf;
- r = kingJumps[j][1] + onr;
- if ((f < 0) || (f > 7))
- continue;
- if ((r < 0) || (r > 7))
- continue;
- if ((gs->board[f][r] == NOPIECE) ||
- (iscolor(gs->board[f][r], CToggle(gs->onMove))))
- add_pos(f, r, posf, posr, numpos);
- }
+ int f, r;
+ int j;
+ static int kingJumps[8][2] = {
+ {-1, -1},
+ {0, -1},
+ {1, -1},
+ {-1, 1},
+ {0, 1},
+ {1, 1},
+ {-1, 0},
+ {1, 0}
+ };
+
+ for (j = 0; j < 8; j++) {
+ f = kingJumps[j][0] + onf;
+ r = kingJumps[j][1] + onr;
+
+ if ((f < 0) || (f > 7))
+ continue;
+ if ((r < 0) || (r > 7))
+ continue;
+ if ((gs->board[f][r] == NOPIECE) ||
+ (iscolor(gs->board[f][r], CToggle(gs->onMove))))
+ add_pos(f, r, posf, posr, numpos);
+ }
}
/* Doesn't check for check */