1 /* src/client/cleanup.c
3 * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
4 * or any later version. For details on its copyright, license, and warranties,
5 * see the file NOTICE in the root directory of the PlomRogue source package.
9 #include <ncurses.h> /* for endwin() */
10 #include <stdint.h> /* uint32_t */
11 #include <stdlib.h> /* free() */
12 #include "../common/readwrite.h" /* try_fclose() */
13 #include "command_db.h" /* free_command_db() */
14 #include "interface_conf.h" /* unload_interface_conf() */
15 #include "world.h" /* world global */
19 /* The clean-up flags set by set_cleanup_flag(). */
20 static uint32_t cleanup_flags = 0x0000;
26 free(world.map.cells);
29 free(world.things_here);
31 free(world.player_inventory);
32 if (cleanup_flags & CLEANUP_INTERFACE)
34 unload_interface_conf();
36 if (cleanup_flags & CLEANUP_NCURSES)
40 if (cleanup_flags & CLEANUP_COMMANDS)
44 if (cleanup_flags & CLEANUP_SERVER_IN)
46 try_fclose(world.file_server_in, __func__);
48 if (cleanup_flags & CLEANUP_SERVER_OUT)
50 try_fclose(world.file_server_out, __func__);
55 extern void set_cleanup_flag(enum cleanup_flag flag)
57 cleanup_flags = cleanup_flags | flag;