timeout.h

Go to the documentation of this file.
00001 /*      SCCS Id: @(#)timeout.h  3.4     1999/02/13      */
00002 /* Copyright 1994, Dean Luick                                     */
00003 /* NetHack may be freely redistributed.  See license for details. */
00004 
00005 #ifndef TIMEOUT_H
00006 #define TIMEOUT_H
00007 
00008 /* generic timeout function */
00009 typedef void FDECL((*timeout_proc), (genericptr_t, long));
00010 
00011 /* kind of timer */
00012 #define TIMER_LEVEL     0       /* event specific to level */
00013 #define TIMER_GLOBAL    1       /* event follows current play */
00014 #define TIMER_OBJECT    2       /* event follows a object */
00015 #define TIMER_MONSTER   3       /* event follows a monster */
00016 
00017 /* save/restore timer ranges */
00018 #define RANGE_LEVEL  0          /* save/restore timers staying on level */
00019 #define RANGE_GLOBAL 1          /* save/restore timers following global play */
00020 
00021 /*
00022  * Timeout functions.  Add a define here, then put it in the table
00023  * in timeout.c.  "One more level of indirection will fix everything."
00024  */
00025 #define ROT_ORGANIC     0       /* for buried organics */
00026 #define ROT_CORPSE      1
00027 #define REVIVE_MON      2
00028 #define BURN_OBJECT     3
00029 #define HATCH_EGG       4
00030 #define FIG_TRANSFORM   5
00031 #define NUM_TIME_FUNCS  6
00032 
00033 /* used in timeout.c */
00034 typedef struct fe {
00035     struct fe *next;            /* next item in chain */
00036     long timeout;               /* when we time out */
00037     unsigned long tid;          /* timer ID */
00038     short kind;                 /* kind of use */
00039     short func_index;           /* what to call when we time out */
00040     genericptr_t arg;           /* pointer to timeout argument */
00041     Bitfield (needs_fixup,1);   /* does arg need to be patched? */
00042 } timer_element;
00043 
00044 #endif /* TIMEOUT_H */