From 740ccc108a3772bf7db5b87fac569f82e42c8324 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 31 Dec 2023 17:38:04 +0100 Subject: Reformatted player_find_part_login() --- FICS/playerdb.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'FICS/playerdb.c') diff --git a/FICS/playerdb.c b/FICS/playerdb.c index be83fe5..be6e18e 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -1007,29 +1007,32 @@ PUBLIC int player_find_bylogin(char *name) return -1; } -PUBLIC int player_find_part_login(char *name) +PUBLIC int +player_find_part_login(char *name) { - int i; - int found = -1; + int found = -1; + int i; - i = player_find_bylogin(name); - if (i >= 0) - return i; - for (i = 0; i < p_num; i++) { - if ((parray[i].status == PLAYER_EMPTY) || - (parray[i].status == PLAYER_LOGIN) || - (parray[i].status == PLAYER_PASSWORD)) - continue; - if (!parray[i].login) - continue; - if (!strncmp(parray[i].login, name, strlen(name))) { - if (found >= 0) { /* Ambiguous */ - return -2; - } - found = i; - } - } - return found; + if ((i = player_find_bylogin(name)) >= 0) + return i; + + for (i = 0; i < p_num; i++) { + if (parray[i].status == PLAYER_EMPTY || + parray[i].status == PLAYER_LOGIN || + parray[i].status == PLAYER_PASSWORD) + continue; + + if (!parray[i].login) + continue; + + if (!strncmp(parray[i].login, name, strlen(name))) { + if (found >= 0) /* Ambiguous */ + return -2; + found = i; + } + } + + return found; } PUBLIC int -- cgit v1.2.3