OSDN Git Service

import nethack-3.6.0
[jnethack/source.git] / include / context.h
1 /* NetHack 3.6  context.h       $NHDT-Date: 1447653421 2015/11/16 05:57:01 $  $NHDT-Branch: master $:$NHDT-Revision: 1.28 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 /* If you change the context structure make sure you increment EDITLEVEL in */
6 /* patchlevel.h if needed. */
7
8 #ifndef CONTEXT_H
9 #define CONTEXT_H
10
11 #define CONTEXTVERBSZ 30
12
13 /*
14  * The context structure houses things that the game tracks
15  * or adjusts during the game, to preserve game state or context.
16  *
17  * The entire structure is saved with the game.
18  *
19  */
20
21 struct dig_info { /* apply.c, hack.c */
22     int effort;
23     d_level level;
24     coord pos;
25     long lastdigtime;
26     boolean down, chew, warned, quiet;
27 };
28
29 struct tin_info {
30     struct obj *tin;
31     unsigned o_id; /* o_id of tin in save file */
32     int usedtime, reqtime;
33 };
34
35 struct book_info {
36     struct obj *book; /* last/current book being xscribed */
37     unsigned o_id;    /* o_id of book in save file */
38     schar delay;      /* moves left for this spell */
39 };
40
41 struct takeoff_info {
42     long mask;
43     long what;
44     int delay;
45     boolean cancelled_don;
46     char disrobing[CONTEXTVERBSZ + 1];
47 };
48
49 struct victual_info {
50     struct obj *piece; /* the thing being eaten, or last thing that
51                         * was partially eaten, unless that thing was
52                         * a tin, which uses the tin structure above,
53                         * in which case this should be 0 */
54     unsigned o_id;     /* o_id of food object in save file */
55     /* doeat() initializes these when piece is valid */
56     int usedtime,          /* turns spent eating */
57         reqtime;           /* turns required to eat */
58     int nmod;              /* coded nutrition per turn */
59     Bitfield(canchoke, 1); /* was satiated at beginning */
60
61     /* start_eating() initializes these */
62     Bitfield(fullwarn, 1); /* have warned about being full */
63     Bitfield(eating, 1);   /* victual currently being eaten */
64     Bitfield(doreset, 1);  /* stop eating at end of turn */
65 };
66
67 struct warntype_info {
68     unsigned long obj;        /* object warn_of_mon monster type M2 */
69     unsigned long polyd;      /* warn_of_mon monster type M2 due to poly */
70     struct permonst *species; /* particular species due to poly */
71     short speciesidx; /* index of above in mons[] (for save/restore) */
72 };
73
74 struct polearm_info {
75     struct monst *hitmon; /* the monster we tried to hit last */
76     unsigned m_id;        /* monster id of hitmon, in save file */
77 };
78
79 struct obj_split {
80     unsigned parent_oid, /* set: splitobj(),         */
81              child_oid;  /* reset: clear_splitobjs() */
82 };
83
84 struct tribute_info {
85     size_t tributesz;       /* make it possible to skip this in future */
86     boolean enabled;        /* Do we have tributes turned on? */
87     Bitfield(bookstock, 1); /* Have we stocked the book? */
88     Bitfield(Deathnotice,1);    /* Did Death notice the book? */
89     /* Markers for other tributes can go here */
90     /* 30 free bits */
91 };
92
93 struct novel_tracking { /* for choosing random passage when reading novel */
94     unsigned id;        /* novel oid from previous passage selection */
95     int count;          /* number of passage indices available in pasg[] */
96     xchar pasg[30];     /* pasg[0..count] are passage indices */
97 };
98
99 struct context_info {
100     unsigned ident;         /* social security number for each monster */
101     unsigned no_of_wizards; /* 0, 1 or 2 (wizard and his shadow) */
102     unsigned run;           /* 0: h (etc), 1: H (etc), 2: fh (etc) */
103                             /* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */
104                             /* 8: travel */
105     unsigned startingpet_mid;
106     int current_fruit; /* fruit->fid corresponding to pl_fruit[] */
107     int warnlevel;
108     int rndencode;          /* randomized escape sequence introducer */
109     long next_attrib_check; /* next attribute check */
110     long stethoscope_move;
111     short stethoscope_movement;
112     boolean travel;  /* find way automatically to u.tx,u.ty */
113     boolean travel1; /* first travel step */
114     boolean forcefight;
115     boolean nopick; /* do not pickup objects (as when running) */
116     boolean made_amulet;
117     boolean mon_moving; /* monsters' turn to move */
118     boolean move;
119     boolean mv;
120     boolean bypasses;    /* bypass flag is set on at least one fobj */
121     boolean botl;        /* partially redo status line */
122     boolean botlx;       /* print an entirely new bottom line */
123     boolean door_opened; /* set to true if door was opened during test_move */
124     struct dig_info digging;
125     struct victual_info victual;
126     struct tin_info tin;
127     struct book_info spbook;
128     struct takeoff_info takeoff;
129     struct warntype_info warntype;
130     struct polearm_info polearm;
131     struct obj_split objsplit; /* track most recently split object stack */
132     struct tribute_info tribute;
133     struct novel_tracking novel;
134 };
135
136 extern NEARDATA struct context_info context;
137
138 #endif /* CONTEXT_H */