diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-31 15:38:58 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-31 15:38:58 +0100 |
commit | 5d5da755a66ac3940b7808c311323f200a8c1a23 (patch) | |
tree | a67a929f82a0de77f0d32405ea51e8bf210278ee | |
parent | 7f31f861f656c867ba11cf2afb7d2fa22aeb6dbb (diff) |
Reformatted player_find_pendfrom()
-rw-r--r-- | FICS/playerdb.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c index 0be118b..9f6d4c7 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -1410,27 +1410,31 @@ PUBLIC int player_remove_pendto(int p, int p1, int type) return 0; } -PUBLIC int player_find_pendfrom(int p, int p1, int type) +PUBLIC int +player_find_pendfrom(int p, int p1, int type) { - int i; + for (int i = 0; i < parray[p].num_from; i++) { + if (parray[p].p_from_list[i].whofrom != p1 && p1 != -1) + continue; + if (type == PEND_ALL || parray[p].p_from_list[i].type == type) + return i; + if (type < 0 && parray[p].p_from_list[i].type != -type) + return i; + /* + * The above "if" allows a type of -PEND_SIMUL to + * match every request EXCEPT simuls, for example. I'm + * doing this because Heringer does not want to + * decline simul requests when he makes a move in a + * sumul. -- hersco. + */ + + if (type == PEND_BUGHOUSE && + parray[p].p_from_list[i].type == PEND_MATCH && + !strcmp(parray[p].p_from_list[i].char2, "bughouse")) + return i; + } - for (i = 0; i < parray[p].num_from; i++) { - if (parray[p].p_from_list[i].whofrom != p1 && p1 != -1) - continue; - if (type == PEND_ALL || parray[p].p_from_list[i].type == type) - return i; - if (type < 0 && parray[p].p_from_list[i].type != -type) - return i; - /* The above "if" allows a type of -PEND_SIMUL to match every request - EXCEPT simuls, for example. I'm doing this because Heringer does - not want to decline simul requests when he makes a move in a sumul. - -- hersco. */ - if (type == PEND_BUGHOUSE - && parray[p].p_from_list[i].type == PEND_MATCH - && !strcmp(parray[p].p_from_list[i].char2, "bughouse")) - return i; - } - return -1; + return -1; } PUBLIC int |