diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-28 16:53:53 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-28 16:53:53 +0200 |
commit | da7f99e51a9c2a999bf6b874175ee6e9931c58b3 (patch) | |
tree | 3ccff1f7dd39bb14490bc528801bb96f6805c24d /FICS | |
parent | d6e0db231ea99db66f3311183afc15922e42c9b8 (diff) |
Reformatted GameNumFromParam()
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/obsproc.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c index 644a54b..08c1eaa 100644 --- a/FICS/obsproc.c +++ b/FICS/obsproc.c @@ -47,23 +47,34 @@ #include "rmalloc.h" #include "utils.h" -PUBLIC int GameNumFromParam(int p, int *p1, parameter *param) +PUBLIC int +GameNumFromParam(int p, int *p1, parameter *param) { - if (param->type == TYPE_WORD) { - *p1 = player_find_part_login(param->val.word); - if (*p1 < 0) { - pprintf(p, "No user named \"%s\" is logged in.\n", param->val.word); - return -1; - } - if (parray[*p1].game < 0) - pprintf(p, "%s is not playing a game.\n", parray[*p1].name); - return parray[*p1].game; - } else { /* Must be an integer */ - *p1 = -1; - if (param->val.integer <= 0) - pprintf(p, "%d is not a valid game number.\n", param->val.integer); - return param->val.integer - 1; - } + if (param->type == TYPE_WORD) { + *p1 = player_find_part_login(param->val.word); + + if (*p1 < 0) { + pprintf(p, "No user named \"%s\" is logged in.\n", + param->val.word); + return -1; + } + + if (parray[*p1].game < 0) { + pprintf(p, "%s is not playing a game.\n", + parray[*p1].name); + } + + return parray[*p1].game; + } else { // Must be an integer + *p1 = -1; + + if (param->val.integer <= 0) { + pprintf(p, "%d is not a valid game number.\n", + param->val.integer); + } + + return (param->val.integer - 1); + } } PRIVATE int |