… | |
… | |
1191 | write_todclock (); /* lets just write the clock here */ |
1191 | write_todclock (); /* lets just write the clock here */ |
1192 | } |
1192 | } |
1193 | |
1193 | |
1194 | /* clean up everything before exiting */ |
1194 | /* clean up everything before exiting */ |
1195 | void |
1195 | void |
1196 | cleanup (void) |
1196 | cleanup (bool make_core) |
1197 | { |
1197 | { |
1198 | LOG (llevDebug, "Cleanup called.\n"); |
1198 | LOG (llevDebug, "Cleanup called.\n"); |
1199 | |
1199 | |
|
|
1200 | if (init_done) |
|
|
1201 | { |
1200 | for (player *pl = first_player; pl != NULL; pl = pl->next) |
1202 | for (player *pl = first_player; pl != NULL; pl = pl->next) |
1201 | save_player (pl->ob, 0); |
1203 | save_player (pl->ob, 0); |
1202 | |
1204 | |
1203 | for (player *pl = first_player; pl != NULL; pl = pl->next) |
1205 | for (player *pl = first_player; pl != NULL; pl = pl->next) |
1204 | if (!QUERY_FLAG (pl->ob, FLAG_REMOVED)) |
1206 | if (!QUERY_FLAG (pl->ob, FLAG_REMOVED)) |
1205 | leave_map (pl->ob); |
1207 | leave_map (pl->ob); |
1206 | |
1208 | |
1207 | clean_tmp_files (); |
1209 | clean_tmp_files (); |
1208 | write_book_archive (); |
1210 | write_book_archive (); |
1209 | |
1211 | |
1210 | INVOKE_GLOBAL (CLEANUP); |
1212 | INVOKE_GLOBAL (CLEANUP); |
|
|
1213 | } |
1211 | |
1214 | |
|
|
1215 | if (make_core) |
|
|
1216 | abort (); |
|
|
1217 | else |
1212 | _exit (0); |
1218 | _exit (0); |
1213 | } |
1219 | } |
1214 | |
1220 | |
1215 | void |
1221 | void |
1216 | leave (player *pl, int draw_exit) |
1222 | leave (player *pl, int draw_exit) |
1217 | { |
1223 | { |