diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-28 13:43:37 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-28 13:43:37 +0200 |
commit | 9382c69b0a3728d60cad619bfefc7d85a7160e6f (patch) | |
tree | 0aad203557e63a1b62d91089ba614d732985b917 | |
parent | 5f291e679c366aef5116e3a1c4f9719851fd52f7 (diff) |
Reformatted com_moves()
-rw-r--r-- | FICS/obsproc.c | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c index b0cb429..fa1de12 100644 --- a/FICS/obsproc.c +++ b/FICS/obsproc.c @@ -423,39 +423,53 @@ PUBLIC int com_mexamine(int p, param_list param) return COM_OK; } -PUBLIC int com_moves(int p, param_list param) +PUBLIC int +com_moves(int p, param_list param) { - int g; - int p1; + int g; + int p1; - if (param[0].type == TYPE_NULL) { - if (parray[p].game >=0) { - g = parray[p].game; - } else if (parray[p].num_observe) { - for (g = 0; g < parray[p].num_observe; g++) { - pprintf(p, "%s\n", movesToString(parray[p].observe_list[g], 0)); - } - return COM_OK; - } else { - pprintf(p, "You are neither playing, observing nor examining a game.\n"); - return COM_OK; - } - } else { - g = GameNumFromParam(p, &p1, ¶m[0]); - if (g < 0) - return COM_OK; - } - if ((g < 0) || (g >= g_num) || ((garray[g].status != GAME_ACTIVE) && - (garray[g].status != GAME_EXAMINE))) { - pprintf(p, "There is no such game.\n"); - return COM_OK; - } - if ((garray[g].white != p) && (garray[g].black != p) && (garray[g].private) && (parray[p].adminLevel < ADMIN_ADMIN)) { - pprintf(p, "Sorry, that is a private game.\n"); - return COM_OK; - } - pprintf(p, "%s\n", movesToString(g, 0)); /* pgn may break interfaces? */ - return COM_OK; + if (param[0].type == TYPE_NULL) { + if (parray[p].game >=0) { + g = parray[p].game; + } else if (parray[p].num_observe) { + for (g = 0; g < parray[p].num_observe; g++) { + pprintf(p, "%s\n", + movesToString(parray[p].observe_list[g], + 0)); + } + + return COM_OK; + } else { + pprintf(p, "You are neither playing, observing nor " + "examining a game.\n"); + return COM_OK; + } + } else { + g = GameNumFromParam(p, &p1, ¶m[0]); + + if (g < 0) + return COM_OK; + } + + if ((g < 0) || + (g >= g_num) || + ((garray[g].status != GAME_ACTIVE) && + (garray[g].status != GAME_EXAMINE))) { + pprintf(p, "There is no such game.\n"); + return COM_OK; + } + + if ((garray[g].white != p) && + (garray[g].black != p) && + (garray[g].private) && + (parray[p].adminLevel < ADMIN_ADMIN)) { + pprintf(p, "Sorry, that is a private game.\n"); + return COM_OK; + } + + pprintf(p, "%s\n", movesToString(g, 0)); // pgn may break interfaces? + return COM_OK; } PUBLIC int |