aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/command.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-03-31 14:03:55 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-03-31 14:03:55 +0200
commit3d89d4a87a4d30cda0d866b590db20771c090e04 (patch)
tree6c79a389f20a10cb1eb4fa638940f9d7dd182b5a /FICS/command.c
parent4c362b7b73c319ab0bb7a3426cb5dfa1af2bd219 (diff)
Reformatted TerminateCleanup()
Diffstat (limited to 'FICS/command.c')
-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);
+ }
+ }
}