3 * Routines to exit the game orderly or on error, with as much cleaning up as is
4 * possible in both cases.
12 #include <stdint.h> /* for uint8_t */
17 /* set_cleanup_flag() sets any of the flags defined in cleanup_flag to announce
18 * the resources that need cleaning up upon program exit. It is to be called at
19 * the earliest moment possible after resource creation / initialization.
23 CLEANUP_NCURSES = 0x0001,
25 CLEANUP_KEYBINDINGS = 0x0004,
27 CLEANUP_COMMAND_DB = 0x0010,
28 CLEANUP_MAP_OBJECTS = 0x0020,
29 CLEANUP_MAP_OBJECT_DEFS = 0x0040,
30 CLEANUP_WIN_META = 0x0080,
31 CLEANUP_WINCONFS = 0x0100
33 extern void set_cleanup_flag(enum cleanup_flag flag);
37 /* Exit orderly, clean up. */
38 extern void exit_game(struct World * world);
42 /* If "err" == 0, do nothing. Else, clean up and exit with an error message that
43 * consists, first, of "msg" or (if "msg" is a NULL pointer) a generic "Details
44 * unknown", secondly of "err" as the "internal error code", and thirdly of
45 * errno if it is non-zero.
47 extern void exit_err(uint8_t err, struct World * world, char * msg);