Wikihack
Advertisement

Below is the full text to region.h from the source code of NetHack 3.4.0. To link to a particular line, write [[NetHack 3.4.0/region.h#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

The NetHack General Public License applies to screenshots, source code and other content from NetHack.
1.    /*	SCCS Id: @(#)region.h	3.4	1996/06/17	*/
2.    /* Copyright (c) 1996 by Jean-Christophe Collet			  */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef REGION_H
6.    #define REGION_H
7.    
8.    /* generic callback function */
9.    
10.   typedef boolean FDECL((*callback_proc), (genericptr_t, genericptr_t));
11.   
12.   typedef struct {
13.     NhRect bounding_box;		/* Bounding box of the region */
14.     NhRect *rects;		/* Rectangles composing the region */
15.     short  nrects;		/* Number of rectangles  */
16.     boolean attach_2_u;		/* Region attached to player ? */
17.     unsigned int attach_2_m;	/* Region attached to monster ? */
18.     /*struct obj *attach_2_o;*/	/* Region attached to object ? UNUSED YET */
19.     const char* enter_msg;	/* Message when entering */
20.     const char* leave_msg;	/* Message when leaving */
21.     short  ttl;			/* Time to live. -1 is forever */
22.     short expire_f;		/* Function to call when region's ttl expire */
23.     short can_enter_f;		/* Function to call to check wether the player
24.   				   can, or can not, enter the region */
25.     short enter_f;		/* Function to call when the player enters*/
26.     short can_leave_f;		/* Function to call to check wether the player
27.   				   can, or can not, leave the region */
28.     short leave_f;		/* Function to call when the player leaves */
29.     short inside_f;		/* Function to call every turn if player's
30.   				   inside */
31.     boolean player_inside;	/* Is the player inside this region */
32.     unsigned int* monsters;	/* Monsters currently inside this region */
33.     short n_monst;		/* Number of monsters inside this region */
34.     short max_monst;		/* Maximum number of monsters that can be
35.   				   listed without having to grow the array */
36.   #define MONST_INC	5
37.   
38.     /* Should probably do the same thing about objects */
39.   
40.     boolean visible;		/* Is the region visible ? */
41.     int glyph;			/* Which glyph to use if visible */
42.     genericptr_t arg;		/* Optional user argument (Ex: strength of
43.   				   force field, damage of a fire zone, ...*/
44.   } NhRegion;
45.   
46.   #endif /* REGION_H */
Advertisement