aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/gameproc.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-03-30 13:25:50 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-03-30 13:25:50 +0100
commit753b08883cf730f31e20a37cb4349a4b9b505ef8 (patch)
tree03062b97747320baca5db9e55c22be10513f07fe /FICS/gameproc.c
parent0f8cc2ed7552327a56f16490e32187533395af41 (diff)
Reformatted com_resign()
Diffstat (limited to 'FICS/gameproc.c')
-rw-r--r--FICS/gameproc.c87
1 files changed, 50 insertions, 37 deletions
diff --git a/FICS/gameproc.c b/FICS/gameproc.c
index 67b5b57..3fc0f15 100644
--- a/FICS/gameproc.c
+++ b/FICS/gameproc.c
@@ -690,45 +690,58 @@ process_move(int p, char *command)
}
}
-PUBLIC int com_resign(int p, param_list param)
+PUBLIC int
+com_resign(int p, param_list param)
{
- int g, o, oconnected;
+ int g, o, oconnected;
- if (param[0].type == TYPE_NULL) {
- g = parray[p].game;
- if (!pIsPlaying(p)) {
- return COM_OK;
- } else {
- player_decline_offers(p, -1, -1);
- game_ended(g, (garray[g].white == p) ? BLACK : WHITE, END_RESIGN);
- }
- } else if (FindPlayer(p, param[0].val.word, &o, &oconnected)) {
- g = game_new();
- if (game_read(g, p, o) < 0) {
- if (game_read(g, o, p) < 0) {
- pprintf(p, "You have no stored game with %s\n", parray[o].name);
- if (!oconnected)
- player_remove(o);
- return COM_OK;
- } else {
- garray[g].white = o;
- garray[g].black = p;
- }
- } else {
- garray[g].white = p;
- garray[g].black = o;
- }
- pprintf(p, "You resign your stored game with %s\n", parray[o].name);
- game_delete(garray[g].white, garray[g].black);
- game_ended(g, (garray[g].white == p) ? BLACK : WHITE, END_RESIGN);
- pcommand(p, "message %s I have resigned our stored game \"%s vs. %s.\"",
- parray[o].name,
- parray[garray[g].white].name,
- parray[garray[g].black].name);
- if (!oconnected)
- player_remove(o);
- }
- return COM_OK;
+ if (param[0].type == TYPE_NULL) {
+ g = parray[p].game;
+
+ if (!pIsPlaying(p))
+ return COM_OK;
+ else {
+ player_decline_offers(p, -1, -1);
+ game_ended(g, (garray[g].white == p ? BLACK : WHITE),
+ END_RESIGN);
+ }
+ } else if (FindPlayer(p, param[0].val.word, &o, &oconnected)) {
+ g = game_new();
+
+ if (game_read(g, p, o) < 0) {
+ if (game_read(g, o, p) < 0) {
+ pprintf(p, "You have no stored game with %s\n",
+ parray[o].name);
+ if (!oconnected)
+ player_remove(o);
+ return COM_OK;
+ } else {
+ garray[g].white = o;
+ garray[g].black = p;
+ }
+ } else {
+ garray[g].white = p;
+ garray[g].black = o;
+ }
+
+ pprintf(p, "You resign your stored game with %s\n",
+ parray[o].name);
+
+ game_delete(garray[g].white, garray[g].black);
+ game_ended(g, (garray[g].white == p ? BLACK : WHITE),
+ END_RESIGN);
+
+ pcommand(p, "message %s I have resigned our stored game "
+ "\"%s vs. %s.\"",
+ parray[o].name,
+ parray[garray[g].white].name,
+ parray[garray[g].black].name);
+
+ if (!oconnected)
+ player_remove(o);
+ }
+
+ return COM_OK;
}
PRIVATE int