From d3c386c90fda388721949610d79c9db4903236d1 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 28 Apr 2024 15:53:23 +0200 Subject: Reformatted functions --- FICS/obsproc.c | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'FICS') diff --git a/FICS/obsproc.c b/FICS/obsproc.c index e3be75e..e1f93b5 100644 --- a/FICS/obsproc.c +++ b/FICS/obsproc.c @@ -203,35 +203,39 @@ PRIVATE int do_observe(int p, int obgame) return COM_OK; } -PUBLIC void unobserveAll(int p) +PUBLIC void +unobserveAll(int p) { - int i; + for (int i = 0; i < parray[p].num_observe; i++) { + pprintf(p, "Removing game %d from observation list.\n", + (parray[p].observe_list[i] + 1)); + } - for (i = 0; i < parray[p].num_observe; i++) { - pprintf(p, "Removing game %d from observation list.\n", parray[p].observe_list[i] + 1); - } - parray[p].num_observe = 0; - return; + parray[p].num_observe = 0; } -PUBLIC int com_unobserve(int p, param_list param) +PUBLIC int +com_unobserve(int p, param_list param) { - int gNum, p1; + int gNum, p1; - if (param[0].type == TYPE_NULL) { - unobserveAll(p); - return COM_OK; - } - gNum = GameNumFromParam(p, &p1, ¶m[0]); - if (gNum < 0) - return COM_OK; - if (!player_is_observe(p, gNum)) { - pprintf(p, "You are not observing game %d.\n", gNum); - } else { - player_remove_observe(p, gNum); - pprintf(p, "Removing game %d from observation list.\n", gNum + 1); - } - return COM_OK; + if (param[0].type == TYPE_NULL) { + unobserveAll(p); + return COM_OK; + } + + if ((gNum = GameNumFromParam(p, &p1, ¶m[0])) < 0) + return COM_OK; + + if (!player_is_observe(p, gNum)) { + pprintf(p, "You are not observing game %d.\n", gNum); + } else { + player_remove_observe(p, gNum); + pprintf(p, "Removing game %d from observation list.\n", + (gNum + 1)); + } + + return COM_OK; } PUBLIC int -- cgit v1.2.3