OSDN Git Service

0ac85a3c877344500fba0faeeb55f7543f746880
[jnethack/source.git] / include / timeout.h
1 /* NetHack 3.6  timeout.h       $NHDT-Date: 1564269131 2019/07/27 23:12:11 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.12 $ */
2 /* Copyright 1994, Dean Luick                                     */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 #ifndef TIMEOUT_H
6 #define TIMEOUT_H
7
8 /* generic timeout function */
9 typedef void FDECL((*timeout_proc), (ANY_P *, long));
10
11 /* kind of timer */
12 enum timer_type {
13     TIMER_LEVEL = 0,   /* event specific to level [melting ice] */
14     TIMER_GLOBAL = 1,  /* event follows current play [not used] */
15     TIMER_OBJECT = 2,  /* event follows an object [various] */
16     TIMER_MONSTER = 3, /* event follows a monster [not used] */
17     NUM_TIMER_KINDS    /* 4 */
18 };
19
20 /* save/restore timer ranges */
21 #define RANGE_LEVEL 0  /* save/restore timers staying on level */
22 #define RANGE_GLOBAL 1 /* save/restore timers following global play */
23
24 /*
25  * Timeout functions.  Add a define here, then put it in the table
26  * in timeout.c.  "One more level of indirection will fix everything."
27  */
28 enum timeout_types {
29     ROT_ORGANIC = 0, /* for buried organics */
30     ROT_CORPSE,
31     REVIVE_MON,
32     BURN_OBJECT,
33     HATCH_EGG,
34     FIG_TRANSFORM,
35     MELT_ICE_AWAY,
36
37     NUM_TIME_FUNCS
38 };
39
40 /* used in timeout.c */
41 typedef struct fe {
42     struct fe *next;          /* next item in chain */
43     long timeout;             /* when we time out */
44     unsigned long tid;        /* timer ID */
45     short kind;               /* kind of use */
46     short func_index;         /* what to call when we time out */
47     anything arg;             /* pointer to timeout argument */
48     Bitfield(needs_fixup, 1); /* does arg need to be patched? */
49 } timer_element;
50
51 #endif /* TIMEOUT_H */