home · contact · privacy
Renamed all "fail" variables to "err", to reduce line lengths.
[plomrogue] / src / rexit.h
1 /* rexit.h
2  *
3  * Routines to exit the game orderly or on error, with as much cleaning up as is
4  * possible in both cases.
5  */
6
7 #ifndef REXIT_H
8 #define REXIT_H
9
10
11
12 struct World;
13 struct Map;
14
15
16
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.
20  */
21 enum cleanup_flag
22 {
23     CLEANUP_NCURSES     = 0x01,
24     CLEANUP_MAP         = 0x02,
25     CLEANUP_KEYBINDINGS = 0x04,
26     CLEANUP_LOG         = 0x08
27 };
28 extern void set_cleanup_flag(enum cleanup_flag flag);
29
30
31
32 /* Exit orderly, clean up. */
33 extern void exit_game(struct World * world);
34
35
36
37 /* If "err" != 0, exit with an error message "msg" and clean up. (For "err",
38  * pass the result of functions that return non-zero as an error status and
39  * thereby avoid bloating up the code with if-error-conditionals.)
40  */
41 extern void exit_err(unsigned char err, struct World * world, char * msg);
42
43
44
45 #endif