diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-14 14:16:52 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-14 14:16:52 +0200 |
commit | 67431b9f231719ddb7cb0dc3b749b002afe0280f (patch) | |
tree | d93ce2e3891187532864e7e6a8a3142af2550cd6 | |
parent | 65bcda9407a65e1daeecb40f118bc57abe80fb54 (diff) |
Reformatted com_shout()
-rw-r--r-- | FICS/talkproc.c | 120 |
1 files changed, 68 insertions, 52 deletions
diff --git a/FICS/talkproc.c b/FICS/talkproc.c index 1de4503..fdc3c24 100644 --- a/FICS/talkproc.c +++ b/FICS/talkproc.c @@ -77,60 +77,76 @@ int CheckShoutQuota(int p) } } -PUBLIC int com_shout(int p, param_list param) +PUBLIC int +com_shout(int p, param_list param) { - int p1; - int count = 0; - int timeleft; /* time left for quota if applicable */ + int count = 0; + int p1; + int timeleft; // time left for quota if applicable - if (!parray[p].registered) { - pprintf(p, "Only registered players can use the shout command.\n"); - return COM_OK; - } - if (in_list(p, L_MUZZLE, parray[p].login)) { - pprintf(p, "You are muzzled.\n"); - return COM_OK; - } - if (param[0].type == TYPE_NULL) { - if ((timeleft = CheckShoutQuota(p))) { - pprintf(p, "Next shout available in %d seconds.\n", timeleft); - } else { - pprintf(p, "Your next shout is ready for use.\n"); - } - return COM_OK; - } - if ((timeleft = CheckShoutQuota(p))) { - pprintf(p, "Shout not sent. Next shout in %d seconds.\n", timeleft); - return COM_OK; - } - parray[p].lastshout_a = parray[p].lastshout_b; - parray[p].lastshout_b = time(0); - if (!printablestring(param[0].val.string)) { - pprintf(p, "Your message contains some unprintable character(s).\n"); - return COM_OK; - } -/* in_push(IN_SHOUT); */ - for (p1 = 0; p1 < p_num; p1++) { - if (p1 == p) - continue; - if (parray[p1].status != PLAYER_PROMPT) - continue; - if (!parray[p1].i_shout) - continue; - if (player_censored(p1, p)) - continue; - count++; - pprintf_prompt(p1, "\n%s shouts: %s\n", parray[p].name, - param[0].val.string); - } - pprintf(p, "(%d) %s shouts: %s\n", count, parray[p].name, - param[0].val.string); -/* in_pop(); */ - if ((timeleft = CheckShoutQuota(p))) { - pprintf(p, "Next shout in %d seconds.\n", timeleft); - return COM_OK; - } - return COM_OK; + if (!parray[p].registered) { + pprintf(p, "Only registered players can use the shout " + "command.\n"); + return COM_OK; + } + + if (in_list(p, L_MUZZLE, parray[p].login)) { + pprintf(p, "You are muzzled.\n"); + return COM_OK; + } + + if (param[0].type == TYPE_NULL) { + if ((timeleft = CheckShoutQuota(p))) { + pprintf(p, "Next shout available in %d seconds.\n", + timeleft); + } else { + pprintf(p, "Your next shout is ready for use.\n"); + } + + return COM_OK; + } + + if ((timeleft = CheckShoutQuota(p))) { + pprintf(p, "Shout not sent. Next shout in %d seconds.\n", + timeleft); + return COM_OK; + } + + parray[p].lastshout_a = parray[p].lastshout_b; + parray[p].lastshout_b = time(0); + + if (!printablestring(param[0].val.string)) { + pprintf(p, "Your message contains some unprintable " + "character(s).\n"); + return COM_OK; + } + + for (p1 = 0; p1 < p_num; p1++) { + if (p1 == p) + continue; + if (parray[p1].status != PLAYER_PROMPT) + continue; + if (!parray[p1].i_shout) + continue; + if (player_censored(p1, p)) + continue; + + count++; + + pprintf_prompt(p1, "\n%s shouts: %s\n", + parray[p].name, + param[0].val.string); + } + + pprintf(p, "(%d) %s shouts: %s\n", count, parray[p].name, + param[0].val.string); + + if ((timeleft = CheckShoutQuota(p))) { + pprintf(p, "Next shout in %d seconds.\n", timeleft); + return COM_OK; + } + + return COM_OK; } PUBLIC int |