aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--FICS/command.c53
1 files changed, 28 insertions, 25 deletions
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);
+ }
+ }
}