From 8973992cf3dcf3c32ec313eafd399ef96dc75c2d Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sat, 4 May 2024 16:03:37 +0200 Subject: Reformatted send_board_to() --- FICS/gamedb.c | 126 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 65 insertions(+), 61 deletions(-) diff --git a/FICS/gamedb.c b/FICS/gamedb.c index 8554df3..609a4fe 100644 --- a/FICS/gamedb.c +++ b/FICS/gamedb.c @@ -222,76 +222,80 @@ PUBLIC int game_isblitz(int wt, int winc, int bt, int binc, return TYPE_BLITZ; } -PUBLIC void send_board_to(int g, int p) +PUBLIC void +send_board_to(int g, int p) { - char *b; - int side; - int relation; - -/* since we know g and p, figure out our relationship to this game */ - - side = WHITE; - if (garray[g].status == GAME_EXAMINE) { - if (parray[p].game == g) { - relation = 2; - } else { - relation = -2; - } - } else { - if (parray[p].game == g) { - side = parray[p].side; - relation = ((side == garray[g].game_state.onMove) ? 1 : -1); - } else { - relation = 0; - } - } + char *b; + int relation; + int side; - if (parray[p].flip) { /* flip board? */ - if (side == WHITE) - side = BLACK; - else - side = WHITE; - } - game_update_time(g); - b = board_to_string(garray[g].white_name, - garray[g].black_name, - garray[g].wTime, - garray[g].bTime, - &garray[g].game_state, - (garray[g].status == GAME_EXAMINE) ? - garray[g].examMoveList : garray[g].moveList, - parray[p].style, - side, relation, p); + /* + * Since we know 'g' and 'p', figure out our relationship to + * this game... + */ -#ifdef TIMESEAL + side = WHITE; - if (con[parray[p].socket].timeseal) { - if (parray[p].bell) { - pprintf_noformat(p, "\007\n[G]\n%s", b); - } else { - pprintf_noformat(p, "\n[G]\n%s", b); - } - } else { - if (parray[p].bell) { - pprintf_noformat(p, "\007\n%s", b); - } else { - pprintf_noformat(p, "\n%s", b); - } - } + if (garray[g].status == GAME_EXAMINE) { + if (parray[p].game == g) { + relation = 2; + } else { + relation = -2; + } + } else { + if (parray[p].game == g) { + side = parray[p].side; + relation = (side == garray[g].game_state.onMove ? 1 : + -1); + } else { + relation = 0; + } + } -#else + if (parray[p].flip) { // flip board? + if (side == WHITE) + side = BLACK; + else + side = WHITE; + } - if (parray[p].bell) { - pprintf_noformat(p, "\007\n%s", b); - } else { - pprintf_noformat(p, "\n%s", b); - } + game_update_time(g); + b = board_to_string(garray[g].white_name, garray[g].black_name, + garray[g].wTime, + garray[g].bTime, + &garray[g].game_state, + (garray[g].status == GAME_EXAMINE) + ? garray[g].examMoveList + : garray[g].moveList, + parray[p].style, + side, + relation, + p); +#ifdef TIMESEAL + if (con[parray[p].socket].timeseal) { + if (parray[p].bell) { + pprintf_noformat(p, "\007\n[G]\n%s", b); + } else { + pprintf_noformat(p, "\n[G]\n%s", b); + } + } else { + if (parray[p].bell) { + pprintf_noformat(p, "\007\n%s", b); + } else { + pprintf_noformat(p, "\n%s", b); + } + } +#else + if (parray[p].bell) { + pprintf_noformat(p, "\007\n%s", b); + } else { + pprintf_noformat(p, "\n%s", b); + } #endif - if (p != commanding_player) { - pprintf(p, "%s", parray[p].prompt); - } + if (p != commanding_player) + pprintf(p, "%s", parray[p].prompt); } PUBLIC void -- cgit v1.2.3