diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-03-24 15:42:13 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-03-24 15:42:13 +0100 |
commit | 1a1fe94a02107ec1e7b70cd4803552010307d8bf (patch) | |
tree | 3dee975e097a80d654231bd85eb1a728e8bddaac | |
parent | 51fccd6a31cd285d6601ebaca63114a475f664e7 (diff) |
Reformatted com_decline()
-rw-r--r-- | FICS/matchproc.c | 74 |
1 files changed, 41 insertions, 33 deletions
diff --git a/FICS/matchproc.c b/FICS/matchproc.c index 77d5a94..6711c54 100644 --- a/FICS/matchproc.c +++ b/FICS/matchproc.c @@ -1017,42 +1017,50 @@ int WordToOffer (int p, char *Word, int *type, int *p1) return 1; } -PUBLIC int com_decline(int p, param_list param) +PUBLIC int +com_decline(int p, param_list param) { - int declineNum; - int p1 = -1, type = -1; - int count; + int count; + int declineNum; + int p1 = -1; + int type = -1; - if (parray[p].num_from == 0) { - pprintf(p, "You have no pending offers from other players.\n"); - return COM_OK; - } - if (param[0].type == TYPE_NULL) { - if (parray[p].num_from == 1) { - p1 = parray[p].p_from_list[0].whofrom; - type = parray[p].p_from_list[0].type; - } else { - pprintf(p, "You have more than one pending offer. Please specify which one\nyou wish to decline.\n'Pending' will give you the list.\n"); - return COM_OK; - } - } else { - if (param[0].type == TYPE_WORD) { - if (!WordToOffer (p, param[0].val.word, &type, &p1)) - return COM_OK; - } else { /* Must be an integer */ - declineNum = param[0].val.integer - 1; - if (declineNum >= parray[p].num_from || declineNum < 0) { - pprintf(p, "Invalid offer number. Must be between 1 and %d.\n", parray[p].num_from); + if (parray[p].num_from == 0) { + pprintf(p, "You have no pending offers from other players.\n"); + return COM_OK; + } + + if (param[0].type == TYPE_NULL) { + if (parray[p].num_from == 1) { + p1 = parray[p].p_from_list[0].whofrom; + type = parray[p].p_from_list[0].type; + } else { + pprintf(p, "You have more than one pending offer. " + "Please specify which one\nyou wish to decline.\n" + "'Pending' will give you the list.\n"); + return COM_OK; + } + } else { + if (param[0].type == TYPE_WORD) { + if (!WordToOffer (p, param[0].val.word, &type, &p1)) + return COM_OK; + } else { // Must be an integer + declineNum = param[0].val.integer - 1; + + if (declineNum >= parray[p].num_from || declineNum < 0) { + pprintf(p, "Invalid offer number. Must be " + "between 1 and %d.\n", parray[p].num_from); + return COM_OK; + } + + p1 = parray[p].p_from_list[declineNum].whofrom; + type = parray[p].p_from_list[declineNum].type; + } + } + + if ((count = player_decline_offers(p, p1, type)) != 1) + pprintf(p, "%d offers declined\n", count); return COM_OK; - } - p1 = parray[p].p_from_list[declineNum].whofrom; - type = parray[p].p_from_list[declineNum].type; - } - } - count = player_decline_offers(p, p1, type); - if (count != 1) - pprintf(p, "%d offers declined\n", count); - return COM_OK; } PUBLIC int |