OSDN Git Service

add missing "#ifdef X11LARGETILE"
[jnethack/source.git] / include / region.h
1 /* NetHack 3.6  region.h        $NHDT-Date: 1432512779 2015/05/25 00:12:59 $  $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */
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 /*
13  * player_flags
14  */
15 #define REG_HERO_INSIDE 0x01
16 #define REG_NOT_HEROS 0x02
17 #define hero_inside(r) ((r)->player_flags & REG_HERO_INSIDE)
18 #define heros_fault(r) (!((r)->player_flags & REG_NOT_HEROS))
19 #define set_hero_inside(r) ((r)->player_flags |= REG_HERO_INSIDE)
20 #define clear_hero_inside(r) ((r)->player_flags &= ~REG_HERO_INSIDE)
21 #define set_heros_fault(r) ((r)->player_flags &= ~REG_NOT_HEROS)
22 #define clear_heros_fault(r) ((r)->player_flags |= REG_NOT_HEROS)
23
24 /*
25  * Note: if you change the size/type of any of the fields below,
26  *       or add any/remove any fields, you must update the
27  *       bwrite() calls in save_regions(), and the
28  *       mread() calls in rest_regions() in src/region.c
29  *       to reflect the changes.
30  */
31
32 typedef struct {
33     NhRect bounding_box;        /* Bounding box of the region */
34     NhRect *rects;              /* Rectangles composing the region */
35     short nrects;               /* Number of rectangles  */
36     boolean attach_2_u;         /* Region attached to player ? */
37     unsigned int attach_2_m;    /* Region attached to monster ? */
38     /*struct obj *attach_2_o;*/ /* Region attached to object ? UNUSED YET */
39     const char *enter_msg;      /* Message when entering */
40     const char *leave_msg;      /* Message when leaving */
41     long ttl;                   /* Time to live. -1 is forever */
42     short expire_f;            /* Function to call when region's ttl expire */
43     short can_enter_f;         /* Function to call to check whether the player
44                                   can, or can not, enter the region */
45     short enter_f;             /* Function to call when the player enters*/
46     short can_leave_f;         /* Function to call to check whether the player
47                                   can, or can not, leave the region */
48     short leave_f;             /* Function to call when the player leaves */
49     short inside_f;            /* Function to call every turn if player's
50                                   inside */
51     unsigned int player_flags; /* (see above) */
52     unsigned int *monsters;    /* Monsters currently inside this region */
53     short n_monst;             /* Number of monsters inside this region */
54     short max_monst;           /* Maximum number of monsters that can be
55                                   listed without having to grow the array */
56 #define MONST_INC 5
57
58     /* Should probably do the same thing about objects */
59
60     boolean visible; /* Is the region visible ? */
61     int glyph;       /* Which glyph to use if visible */
62     anything arg;    /* Optional user argument (Ex: strength of
63                         force field, damage of a fire zone, ...*/
64 } NhRegion;
65
66 #endif /* REGION_H */