aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/gameproc.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-03-30 13:04:54 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-03-30 13:04:54 +0100
commit761620d5d2783b1cddf2fd8d66007dedcdb371dc (patch)
treecb749fff86d2b3253b99020c02ef69c1a22a26c4 /FICS/gameproc.c
parent706510b089ccb2fb18b5b98c928914043f6a7c5a (diff)
Reformatted com_pause()
Diffstat (limited to 'FICS/gameproc.c')
-rw-r--r--FICS/gameproc.c100
1 files changed, 58 insertions, 42 deletions
diff --git a/FICS/gameproc.c b/FICS/gameproc.c
index 603a580..1a2344c 100644
--- a/FICS/gameproc.c
+++ b/FICS/gameproc.c
@@ -815,50 +815,66 @@ PUBLIC int com_draw(int p, param_list param)
return COM_OK;
}
-PUBLIC int com_pause(int p, param_list param)
+PUBLIC int
+com_pause(int p, param_list param)
{
- int g;
- int now;
+ int g;
+ int now;
- ASSERT(param[0].type == TYPE_NULL);
- if (!pIsPlaying(p)) {
- return COM_OK;
- }
- g = parray[p].game;
- if (garray[g].wTime == 0) {
- pprintf(p, "You can't pause untimed games.\n");
- return COM_OK;
- }
- if (garray[g].clockStopped) {
- pprintf(p, "Game is already paused, use \"unpause\" to resume.\n");
- return COM_OK;
- }
- if (player_find_pendfrom(p, parray[p].opponent, PEND_PAUSE) >= 0) {
- player_remove_request(parray[p].opponent, p, PEND_PAUSE);
- garray[g].clockStopped = 1;
- /* Roll back the time */
- if (garray[g].game_state.onMove == WHITE) {
- garray[g].wTime += (garray[g].lastDecTime - garray[g].lastMoveTime);
- } else {
- garray[g].bTime += (garray[g].lastDecTime - garray[g].lastMoveTime);
- }
- now = tenth_secs();
- if (garray[g].numHalfMoves == 0)
- garray[g].timeOfStart = now;
- garray[g].lastMoveTime = now;
- garray[g].lastDecTime = now;
- send_boards(g);
- pprintf_prompt(parray[p].opponent, "\n%s accepted pause. Game clock paused.\n",
- parray[p].name);
- pprintf(p, "Game clock paused.\n");
- } else {
- pprintf(parray[p].opponent, "\n");
- pprintf_highlight(parray[p].opponent, "%s", parray[p].name);
- pprintf_prompt(parray[p].opponent, " requests to pause the game.\n");
- pprintf(p, "Pause request sent.\n");
- player_add_request(p, parray[p].opponent, PEND_PAUSE, 0);
- }
- return COM_OK;
+ ASSERT(param[0].type == TYPE_NULL);
+
+ if (!pIsPlaying(p))
+ return COM_OK;
+
+ g = parray[p].game;
+
+ if (garray[g].wTime == 0) {
+ pprintf(p, "You can't pause untimed games.\n");
+ return COM_OK;
+ }
+
+ if (garray[g].clockStopped) {
+ pprintf(p, "Game is already paused, "
+ "use \"unpause\" to resume.\n");
+ return COM_OK;
+ }
+
+ if (player_find_pendfrom(p, parray[p].opponent, PEND_PAUSE) >= 0) {
+ player_remove_request(parray[p].opponent, p, PEND_PAUSE);
+ garray[g].clockStopped = 1;
+
+ // Roll back the time
+ if (garray[g].game_state.onMove == WHITE) {
+ garray[g].wTime += (garray[g].lastDecTime -
+ garray[g].lastMoveTime);
+ } else {
+ garray[g].bTime += (garray[g].lastDecTime -
+ garray[g].lastMoveTime);
+ }
+
+ now = tenth_secs();
+
+ if (garray[g].numHalfMoves == 0)
+ garray[g].timeOfStart = now;
+
+ garray[g].lastMoveTime = now;
+ garray[g].lastDecTime = now;
+
+ send_boards(g);
+
+ pprintf_prompt(parray[p].opponent, "\n%s accepted pause. "
+ "Game clock paused.\n", parray[p].name);
+ pprintf(p, "Game clock paused.\n");
+ } else {
+ pprintf(parray[p].opponent, "\n");
+ pprintf_highlight(parray[p].opponent, "%s", parray[p].name);
+ pprintf_prompt(parray[p].opponent, " requests to pause the "
+ "game.\n");
+ pprintf(p, "Pause request sent.\n");
+ player_add_request(p, parray[p].opponent, PEND_PAUSE, 0);
+ }
+
+ return COM_OK;
}
PUBLIC int