From 3d89d4a87a4d30cda0d866b590db20771c090e04 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 31 Mar 2024 14:03:55 +0200 Subject: Reformatted TerminateCleanup() --- FICS/command.c | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'FICS/command.c') diff --git a/FICS/command.c b/FICS/command.c index 5d27580..6ed673a 100644 --- a/FICS/command.c +++ b/FICS/command.c @@ -1078,31 +1078,34 @@ commands_init(void) } /* Need to save rated games */ -PUBLIC void TerminateCleanup() +PUBLIC void +TerminateCleanup(void) { - int p1; - int g; + for (int g = 0; g < g_num; g++) { + if (garray[g].status != GAME_ACTIVE) + continue; + if (garray[g].rated) + game_ended(g, WHITE, END_ADJOURN); + } - for (g = 0; g < g_num; g++) { - if (garray[g].status != GAME_ACTIVE) - continue; - if (garray[g].rated) { - game_ended(g, WHITE, END_ADJOURN); - } - } - for (p1 = 0; p1 < p_num; p1++) { - if (parray[p1].status == PLAYER_EMPTY) - continue; - pprintf(p1, "\n **** Server shutting down immediately. ****\n\n"); - if (parray[p1].status != PLAYER_PROMPT) { - close(parray[p1].socket); - } else { - pprintf(p1, "Logging you out.\n"); - psend_raw_file(p1, mess_dir, MESS_LOGOUT); - player_write_logout(p1); - if (parray[p1].registered) - parray[p1].totalTime += time(0) - parray[p1].logon_time; - player_save(p1); - } - } + for (int p1 = 0; p1 < p_num; p1++) { + if (parray[p1].status == PLAYER_EMPTY) + continue; + + pprintf(p1, "\n **** Server shutting down immediately. " + "****\n\n"); + + if (parray[p1].status != PLAYER_PROMPT) { + close(parray[p1].socket); + } else { + pprintf(p1, "Logging you out.\n"); + psend_raw_file(p1, mess_dir, MESS_LOGOUT); + player_write_logout(p1); + if (parray[p1].registered) { + parray[p1].totalTime += + (time(0) - parray[p1].logon_time); + } + player_save(p1); + } + } } -- cgit v1.2.3