Source:NetHack 3.6.1/include/timeout.h

From NetHackWiki
(Redirected from Timeout.h)
Jump to: navigation, search

Below is the full text to timeout.h from the source code of NetHack 3.6.1. To link to a particular line, write [[Source:NetHack 3.6.1/include/timeout.h#line123]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

  1.  /* NetHack 3.6	timeout.h	$NHDT-Date: 1432512775 2015/05/25 00:12:55 $  $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
  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 */
  14.      TIMER_GLOBAL,  /* event follows current play */
  15.      TIMER_OBJECT,  /* event follows a object */
  16.      TIMER_MONSTER /* event follows a monster */
  17.  };
  18.  
  19.  /* save/restore timer ranges */
  20.  #define RANGE_LEVEL 0  /* save/restore timers staying on level */
  21.  #define RANGE_GLOBAL 1 /* save/restore timers following global play */
  22.  
  23.  /*
  24.   * Timeout functions.  Add a define here, then put it in the table
  25.   * in timeout.c.  "One more level of indirection will fix everything."
  26.   */
  27.  enum timeout_types {
  28.      ROT_ORGANIC = 0, /* for buried organics */
  29.      ROT_CORPSE,
  30.      REVIVE_MON,
  31.      BURN_OBJECT,
  32.      HATCH_EGG,
  33.      FIG_TRANSFORM,
  34.      MELT_ICE_AWAY,
  35.  
  36.      NUM_TIME_FUNCS
  37.  };
  38.  
  39.  /* used in timeout.c */
  40.  typedef struct fe {
  41.      struct fe *next;          /* next item in chain */
  42.      long timeout;             /* when we time out */
  43.      unsigned long tid;        /* timer ID */
  44.      short kind;               /* kind of use */
  45.      short func_index;         /* what to call when we time out */
  46.      anything arg;             /* pointer to timeout argument */
  47.      Bitfield(needs_fixup, 1); /* does arg need to be patched? */
  48.  } timer_element;
  49.  
  50.  #endif /* TIMEOUT_H */