aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/movecheck.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-03-17 18:57:53 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-03-17 18:57:53 +0100
commit3b12135bc38e40dc9814726b861bf2b4ac7c512d (patch)
treef905b456c973335960ce6425c071e519f3163e8e /FICS/movecheck.c
parentb06b25e6d32e25fe18b2b23b38f283491d2a71fd (diff)
Reformatted possible_knight_moves()
Diffstat (limited to 'FICS/movecheck.c')
-rw-r--r--FICS/movecheck.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/FICS/movecheck.c b/FICS/movecheck.c
index 575a7da..a4fa18f 100644
--- a/FICS/movecheck.c
+++ b/FICS/movecheck.c
@@ -382,26 +382,30 @@ PRIVATE void possible_pawn_moves(game_state_t * gs,
}
}
-PRIVATE void possible_knight_moves(game_state_t * gs,
- int onf, int onr,
- int *posf, int *posr, int *numpos)
+PRIVATE void
+possible_knight_moves(game_state_t *gs, int onf, int onr, int *posf, int *posr,
+ int *numpos)
{
- static int knightJumps[8][2] = {{-1, 2}, {1, 2}, {2, -1}, {2, 1},
- {-1, -2}, {1, -2}, {-2, 1}, {-2, -1}};
- int f, r;
- int j;
-
- for (j = 0; j < 8; j++) {
- f = knightJumps[j][0] + onf;
- r = knightJumps[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 knightJumps[8][2] = {
+ {-1, 2}, {1, 2}, {2, -1}, {2, 1}, {-1, -2}, {1, -2}, {-2, 1},
+ {-2, -1}
+ };
+
+ for (j = 0; j < 8; j++) {
+ f = knightJumps[j][0] + onf;
+ r = knightJumps[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);
+ }
}
PRIVATE void