From 622441fe3925e711a90f6bf791146d0f32d154bd Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 31 Dec 2023 16:18:41 +0100 Subject: Reformatted player_count() and switched to a while loop --- FICS/playerdb.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'FICS') diff --git a/FICS/playerdb.c b/FICS/playerdb.c index a1d3e9a..4e69e57 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -1180,20 +1180,25 @@ PUBLIC int showstored(int p) } -PUBLIC int player_count(int CountAdmins) +PUBLIC int +player_count(int CountAdmins) { - int count; - int i; + int count; + int i; - for (count = 0, i = 0; i < p_num; i++) { - if ((parray[i].status == PLAYER_PROMPT) && - (CountAdmins || !in_list(i, L_ADMIN, parray[i].name))) - count++; - } - if (count > player_high) - player_high = count; + count = 0; + i = 0; - return count; + while (i < p_num) { + if (parray[i].status == PLAYER_PROMPT && + (CountAdmins || !in_list(i, L_ADMIN, parray[i].name))) + count++; + i++; + } + + if (count > player_high) + player_high = count; + return count; } PUBLIC int -- cgit v1.2.3