diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-28 15:37:19 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-28 15:37:19 +0200 |
commit | f06f1543fb62948e4f2686c27071a6cd66cd3bb1 (patch) | |
tree | 7d014183e1586e9583c74b0464a0b01d901f0033 /FICS/obsproc.c | |
parent | 5088267dc848cc61a334d3022708133bd296c5db (diff) |
Reformatted com_observe()
Diffstat (limited to 'FICS/obsproc.c')
-rw-r--r-- | FICS/obsproc.c | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c index 3a71ac7..e3be75e 100644 --- a/FICS/obsproc.c +++ b/FICS/obsproc.c @@ -234,36 +234,42 @@ PUBLIC int com_unobserve(int p, param_list param) return COM_OK; } -PUBLIC int com_observe(int p, param_list param) +PUBLIC int +com_observe(int p, param_list param) { - int i; - int p1, obgame; + int i; + int p1, obgame; - if ((parray[p].game >=0) &&(garray[parray[p].game].status == GAME_EXAMINE)) { - pprintf(p, "You are still examining a game.\n"); - return COM_OK; - } - if (param[0].type == TYPE_NULL) { - unobserveAll(p); - return COM_OK; - } - obgame = GameNumFromParam(p, &p1, ¶m[0]); - if (obgame < 0) - return COM_OK; + if (parray[p].game >= 0 && garray[parray[p].game].status == + GAME_EXAMINE) { + pprintf(p, "You are still examining a game.\n"); + return COM_OK; + } - if ((obgame >= g_num) || ((garray[obgame].status != GAME_ACTIVE) && - (garray[obgame].status != GAME_EXAMINE))) { - pprintf(p, "There is no such game.\n"); - return COM_OK; - } - if ((p1 >= 0) && parray[p1].simul_info.numBoards) { - for (i = 0; i < parray[p1].simul_info.numBoards; i++) - if (parray[p1].simul_info.boards[i] >= 0) - do_observe(p, parray[p1].simul_info.boards[i]); - } else { - do_observe(p, obgame); - } - return COM_OK; + if (param[0].type == TYPE_NULL) { + unobserveAll(p); + return COM_OK; + } + + if ((obgame = GameNumFromParam(p, &p1, ¶m[0])) < 0) + return COM_OK; + + if ((obgame >= g_num) || + ((garray[obgame].status != GAME_ACTIVE) && + (garray[obgame].status != GAME_EXAMINE))) { + pprintf(p, "There is no such game.\n"); + return COM_OK; + } + + if (p1 >= 0 && parray[p1].simul_info.numBoards) { + for (i = 0; i < parray[p1].simul_info.numBoards; i++) + if (parray[p1].simul_info.boards[i] >= 0) + do_observe(p, parray[p1].simul_info.boards[i]); + } else { + do_observe(p, obgame); + } + + return COM_OK; } PUBLIC int |