From 2622a3c602ae14a278e7f201a678f9b18dc2ec25 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 31 Dec 2023 14:06:22 +0100 Subject: Reformatted player_goto_prev_board() --- FICS/playerdb.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'FICS') diff --git a/FICS/playerdb.c b/FICS/playerdb.c index fd36646..cbd6937 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -1794,28 +1794,34 @@ PUBLIC int player_goto_next_board(int p) return player_goto_board(p, on); } -PUBLIC int player_goto_prev_board(int p) +PUBLIC int +player_goto_prev_board(int p) { - int on; - int start; - int g; + int g; + int on; + int start; - on = parray[p].simul_info.onBoard; - start = on; - g = -1; - do { - --on; - if (on < 0) - on = (parray[p].simul_info.numBoards) - 1; - g = parray[p].simul_info.boards[on]; - if (g >= 0) - break; - } while (start != on); - if (g == -1) { - pprintf(p, "\nMajor Problem! Can't find your previous board.\n"); - return -1; - } - return player_goto_board(p, on); + on = parray[p].simul_info.onBoard; + start = on; + g = -1; + + do { + --on; + + if (on < 0) + on = (parray[p].simul_info.numBoards) - 1; + + if ((g = parray[p].simul_info.boards[on]) >= 0) + break; + } while (start != on); + + if (g == -1) { + pprintf(p, "\nMajor Problem! Can't find your previous board." + "\n"); + return -1; + } + + return player_goto_board(p, on); } PUBLIC int -- cgit v1.2.3