From 7761d8ab19d9023de23bf8394300a74e55b440bd Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 31 Dec 2023 14:25:44 +0100 Subject: Reformatted player_remove_observe() --- FICS/playerdb.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'FICS/playerdb.c') diff --git a/FICS/playerdb.c b/FICS/playerdb.c index 048ad38..7f12be5 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -1689,21 +1689,25 @@ PUBLIC int player_add_observe(int p, int g) return 0; } -PUBLIC int player_remove_observe(int p, int g) +PUBLIC int +player_remove_observe(int p, int g) { - int i; + int i; - for (i = 0; i < parray[p].num_observe; i++) { - if (parray[p].observe_list[i] == g) - break; - } - if (i == parray[p].num_observe) - return -1; /* Not found! */ - for (; i < parray[p].num_observe - 1; i++) { - parray[p].observe_list[i] = parray[p].observe_list[i + 1]; - } - parray[p].num_observe--; - return 0; + for (i = 0; i < parray[p].num_observe; i++) { + if (parray[p].observe_list[i] == g) + break; + } + + if (i == parray[p].num_observe) + return -1; // Not found! + + for (; i < (parray[p].num_observe - 1); i++) + parray[p].observe_list[i] = parray[p].observe_list[i + 1]; + + parray[p].num_observe--; + + return 0; } PUBLIC int -- cgit v1.2.3