aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/obsproc.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-04-28 15:53:23 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-04-28 15:53:23 +0200
commitd3c386c90fda388721949610d79c9db4903236d1 (patch)
tree8ce9779d48f3186f9ab591a271613942903f0396 /FICS/obsproc.c
parentf06f1543fb62948e4f2686c27071a6cd66cd3bb1 (diff)
Reformatted functions
Diffstat (limited to 'FICS/obsproc.c')
-rw-r--r--FICS/obsproc.c50
1 files changed, 27 insertions, 23 deletions
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, &param[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, &param[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