diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-03-16 20:59:15 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-03-16 20:59:15 +0100 |
commit | c5781670b233a62370cb45c5ae657eec5967cf8b (patch) | |
tree | 56c0e0d3fba27a6dd5d1f82d54d2ee247ce1c601 /FICS | |
parent | 6966dfb5bbc90a6d14fb10a7d351194ea99941c3 (diff) |
Reformatted legal_andcheck_move()
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/movecheck.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/FICS/movecheck.c b/FICS/movecheck.c index 174ef00..0f406e8 100644 --- a/FICS/movecheck.c +++ b/FICS/movecheck.c @@ -737,23 +737,24 @@ move_calculate(game_state_t *gs, move_t *mt, int promote) return MOVE_OK; } -PUBLIC int legal_andcheck_move(game_state_t * gs, - int fFile, int fRank, - int tFile, int tRank) +PUBLIC int +legal_andcheck_move(game_state_t *gs, int fFile, int fRank, + int tFile, int tRank) { - move_t mt; - if (!legal_move(gs, fFile, fRank, tFile, tRank)) - return 0; - mt.color = gs->onMove; - mt.fromFile = fFile; - mt.fromRank = fRank; - mt.toFile = tFile; - mt.toRank = tRank; - /* This should take into account a pawn promoting to another piece */ - if (move_calculate(gs, &mt, QUEEN) == MOVE_OK) - return 1; - else - return 0; + move_t mt; + + if (!legal_move(gs, fFile, fRank, tFile, tRank)) + return 0; + + mt.color = gs->onMove; + mt.fromFile = fFile; + mt.fromRank = fRank; + mt.toFile = tFile; + mt.toRank = tRank; + + if (move_calculate(gs, &mt, QUEEN) == MOVE_OK) + return 1; + return 0; } PUBLIC int |