aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-03-30 13:10:02 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-03-30 13:10:02 +0100
commitf97f76d9e526f9cf6b85d77ff64a4c89df864772 (patch)
tree7b316af826aa051e682775d5ffd689471c322fca
parent761620d5d2783b1cddf2fd8d66007dedcdb371dc (diff)
Reformatted com_draw()
-rw-r--r--FICS/gameproc.c61
1 files changed, 33 insertions, 28 deletions
diff --git a/FICS/gameproc.c b/FICS/gameproc.c
index 1a2344c..38c7849 100644
--- a/FICS/gameproc.c
+++ b/FICS/gameproc.c
@@ -783,36 +783,41 @@ int CheckRepetition (int p, int g)
else return 0;
}
-PUBLIC int com_draw(int p, param_list param)
+PUBLIC int
+com_draw(int p, param_list param)
{
- int p1, g = parray[p].game;
+ int p1, g = parray[p].game;
- ASSERT(param[0].type == TYPE_NULL);
- if (!pIsPlaying(p)) {
- return COM_OK;
- }
- if (Check50MoveRule (p, g) || CheckRepetition(p, g)) {
- return COM_OK;
- }
- p1 = parray[p].opponent;
- if (parray[p1].simul_info.numBoards &&
- parray[p1].simul_info.boards[parray[p1].simul_info.onBoard] !=
- g) {
- pprintf(p, "You can only make requests when the simul player is at your board.\n");
- return COM_OK;
- }
- if (player_find_pendfrom(p, parray[p].opponent, PEND_DRAW) >= 0) {
- player_remove_request(parray[p].opponent, p, PEND_DRAW);
- player_decline_offers(p, -1, -1);
- game_ended(g, (garray[g].white == p) ? BLACK : WHITE, END_AGREEDDRAW);
- } else {
- pprintf(parray[p].opponent, "\n");
- pprintf_highlight(parray[p].opponent, "%s", parray[p].name);
- pprintf_prompt(parray[p].opponent, " offers you a draw.\n");
- pprintf(p, "Draw request sent.\n");
- player_add_request(p, parray[p].opponent, PEND_DRAW, 0);
- }
- return COM_OK;
+ ASSERT(param[0].type == TYPE_NULL);
+
+ if (!pIsPlaying(p))
+ return COM_OK;
+ if (Check50MoveRule(p, g) || CheckRepetition(p, g))
+ return COM_OK;
+
+ p1 = parray[p].opponent;
+
+ if (parray[p1].simul_info.numBoards &&
+ parray[p1].simul_info.boards[parray[p1].simul_info.onBoard] != g) {
+ pprintf(p, "You can only make requests when the simul player "
+ "is at your board.\n");
+ return COM_OK;
+ }
+
+ if (player_find_pendfrom(p, parray[p].opponent, PEND_DRAW) >= 0) {
+ player_remove_request(parray[p].opponent, p, PEND_DRAW);
+ player_decline_offers(p, -1, -1);
+ game_ended(g, (garray[g].white == p ? BLACK : WHITE),
+ END_AGREEDDRAW);
+ } else {
+ pprintf(parray[p].opponent, "\n");
+ pprintf_highlight(parray[p].opponent, "%s", parray[p].name);
+ pprintf_prompt(parray[p].opponent, " offers you a draw.\n");
+ pprintf(p, "Draw request sent.\n");
+ player_add_request(p, parray[p].opponent, PEND_DRAW, 0);
+ }
+
+ return COM_OK;
}
PUBLIC int