1 /* File: types.h */
2 
3 /* Purpose: global type declarations */
4 
5 /*
6  * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
7  *
8  * This software may be copied and distributed for educational, research, and
9  * not for profit purposes provided that this copyright and statement are
10  * included in all such copies.
11  */
12 
13 /*
14  * This file should ONLY be included by "angband.h"
15  */
16 
17 /*
18  * Note that "char" may or may not be signed, and that "signed char"
19  * may or may not work on all machines.  So always use "s16b" or "s32b"
20  * for signed values.  Also, note that unsigned values cause math problems
21  * in many cases, so try to only use "u16b" and "u32b" for "bit flags",
22  * unless you really need the extra bit of information, or you really
23  * need to restrict yourself to a single byte for storage reasons.
24  *
25  * Also, if possible, attempt to restrict yourself to sub-fields of
26  * known size (use "s16b" or "s32b" instead of "int", and "byte" instead
27  * of "bool"), and attempt to align all fields along four-byte words, to
28  * optimize storage issues on 32-bit machines.  Also, avoid "bit flags"
29  * since these increase the code size and slow down execution.  When
30  * you need to store bit flags, use one byte per flag, or, where space
31  * is an issue, use a "byte" or "u16b" or "u32b", and add special code
32  * to access the various bit flags.
33  *
34  * Many of these structures were developed to reduce the number of global
35  * variables, facilitate structured program design, allow the use of ascii
36  * template files, simplify access to indexed data, or facilitate efficient
37  * clearing of many variables at once.
38  *
39  * Certain data is saved in multiple places for efficient access, currently,
40  * this includes the tval/sval/weight fields in "object_type", various fields
41  * in "header_type", and the "m_idx" and "o_idx" fields in "cave_type".  All
42  * of these could be removed, but this would, in general, slow down the game
43  * and increase the complexity of the code.
44  */
45 
46 
47 /**** MAngband specific structs ****/
48 
49 typedef struct cave_type cave_type;
50 typedef struct server_setup_t server_setup_t;
51 typedef struct client_setup_t client_setup_t;
52 typedef struct option_type option_type;
53 typedef struct wilderness_type wilderness_type;
54 typedef struct cave_view_type cave_view_type;
55 typedef struct party_type party_type;
56 typedef struct house_type house_type;
57 typedef struct hostile_type hostile_type;
58 typedef struct history_event history_event;
59 typedef struct channel_type channel_type;
60 typedef struct custom_command_type custom_command_type;
61 typedef struct stream_type stream_type;
62 typedef struct indicator_type indicator_type;
63 typedef struct item_tester_type item_tester_type;
64 
65 
66 /**** MAngband specific structs ****/
67 
68 /*
69  * A single "grid" in a Cave
70  *
71  * Note that several aspects of the code restrict the actual cave
72  * to a max size of 256 by 256.  In partcular, locations are often
73  * saved as bytes, limiting each coordinate to the 0-255 range.
74  *
75  * The "o_idx" and "m_idx" fields are very interesting.  There are
76  * many places in the code where we need quick access to the actual
77  * monster or object(s) in a given cave grid.  The easiest way to
78  * do this is to simply keep the index of the monster and object
79  * (if any) with the grid, but takes a lot of memory.  Several other
80  * methods come to mind, but they all seem rather complicated.
81  *
82  * Note the special fields for the simple "monster flow" code,
83  * and for the "tracking" code.
84  */
85 
86 struct cave_type
87 {
88 	byte info;		/* Hack -- cave flags */
89 
90 	byte feat;		/* Hack -- feature type */
91 
92 	s16b o_idx;		/* Item index (in o_list) or zero */
93 
94 	s16b m_idx;		/* Monster index (in m_list) or zero */
95 				/* or negative if a player */
96 
97 #ifdef MONSTER_FLOW
98 
99 	byte cost;		/* Hack -- cost of flowing */
100 	byte when;		/* Hack -- when cost was computed */
101 
102 #endif
103 
104 };
105 
106 
107 /*
108  * The setup data that the server transmits to the
109  * client.
110  */
111 struct server_setup_t
112 {
113 	byte val1;
114 	byte val2;
115 	byte val3;
116 	byte val4;
117 
118 	byte val5;
119 	byte val6;
120 	byte val7;
121 	byte val8;
122 
123 	u32b val9;
124 	u32b val10;
125 	u32b val11;
126 	u32b val12;
127 
128 	byte val13;
129 	byte val14;
130 	byte val15;
131 	byte val16;
132 };
133 
134 /*
135  * The setup data that the client transmits to the
136  * server.
137  */
138 
139 struct client_setup_t
140 {
141 	int  settings[16];
142 	bool options[64];
143 
144 	byte flvr_x_attr[MAX_FLVR_IDX];
145 	char flvr_x_char[MAX_FLVR_IDX];
146 
147 	byte *f_attr;
148 	char *f_char;
149 
150 	byte *k_attr;
151 	char *k_char;
152 
153 	byte *r_attr;
154 	char *r_char;
155 
156 	byte misc_attr[1024];
157 	char misc_char[1024];
158 
159 	byte tval_attr[128];
160 	char tval_char[128];
161 };
162 
163 
164 /*
165  * Available "options"
166  *
167  *	- Address of actual option variable (or NULL)
168  *
169  *	- Unique option ID (or 0)
170  *
171  *	- Normal Value (TRUE or FALSE)
172  *
173  *	- Option Page Number (or zero)
174  *
175  *	- Savefile Set (or zero)
176  *	- Savefile Bit in that set
177  *
178  *	- Textual name (or NULL)
179  *	- Textual description
180  */
181 
182 struct option_type
183 {
184 	bool	*o_var;
185 	byte	o_uid;
186 
187 	byte	o_norm;
188 
189 	byte	o_page;
190 
191 	byte	o_set;
192 	byte	o_bit;
193 
194 	cptr	o_text;
195 	cptr	o_desc;
196 };
197 
198 
199 
200 /* Adding this structure so we can have different creatures generated
201    in different types of wilderness... this will probably be completly
202    redone when I do a proper landscape generator.
203    -APD-
204 */
205 
206 struct wilderness_type
207 {
208 	int world_x; /* the world coordinates */
209 	int world_y;
210 	int radius; /* the distance from the town */
211 	int type;   /* what kind of terrain we are in */
212 	u16b flags; /* various */
213 };
214 
215 
216 /* The information needed to show a single "grid" */
217 
218 struct cave_view_type
219 {
220 	byte a;		/* Color attribute */
221 	char c;		/* ASCII character */
222 };
223 
224 /*
225  * Information about "Arena" (special building for pvp)
226  */
227 typedef struct arena_type arena_type;
228 struct arena_type
229 {
230 	byte x_1;
231 	byte y_1;
232 	byte x_2;
233 	byte y_2;
234 
235 	s32b depth;
236 
237 	int player1;
238 	int player2;
239 };
240 
241 
242 /*
243  * Information about a "party"
244  */
245 
246 struct party_type
247 {
248 	char name[80];		/* Name of the party */
249 	char owner[20];		/* Owner's name */
250 	s32b num;		/* Number of people in the party */
251 	hturn created;		/* Creation (or disband-tion) time */
252 };
253 
254 /*
255  * Information about a "house"
256  */
257 
258 /*
259 In order to delete the contents of a house after its key is lost,
260 added x_1, y_1, x_2, y_2, which are the locations of the opposite
261 corners of the house.
262 -APD-
263 */
264 
265 struct house_type
266 {
267 	byte x_1;
268 	byte y_1;
269 	byte x_2;
270 	byte y_2;
271 
272 	byte door_y;            	/* Location of door */
273 	byte door_x;
274 
275 	byte strength;          	/* Strength of door (unused) */
276 	char owned[MAX_NAME_LEN+1];	/* Currently owned? */
277 
278 	s32b depth;
279 
280 	s32b price;             	/* Cost of buying */
281 };
282 
283 
284 /*
285  * Information about a "hostility"
286  */
287 
288 struct hostile_type
289 {
290 	s32b id;        	/* ID of player we are hostile to */
291 	hostile_type *next;	/* Next in list */
292 };
293 
294 /*
295  * A single history event
296  */
297 
298 struct history_event
299 {
300 	int days;	/* Timestamp */
301 	int hours;
302 	int mins;
303 
304 	s16b depth;	/* Position */
305 	s16b level;
306 
307 	u16b message; /* Message quark */
308 
309 	history_event *next;	/* Next in list */
310 };
311 
312 /*
313  * Information about a "chat channel"
314  */
315 
316 struct channel_type
317 {
318 	char name[MAX_CHARS];
319 	s32b id;
320 	s32b num;
321 	byte mode;
322 };
323 
324 /**** Available Structs ****/
325 
326 typedef struct header header;
327 typedef struct maxima maxima;
328 typedef struct feature_type feature_type;
329 typedef struct object_kind object_kind;
330 typedef struct artifact_type artifact_type;
331 typedef struct ego_item_type ego_item_type;
332 typedef struct monster_blow monster_blow;
333 typedef struct monster_race monster_race;
334 typedef struct monster_lore monster_lore;
335 typedef struct vault_type vault_type;
336 typedef struct object_type object_type;
337 typedef struct monster_type monster_type;
338 typedef struct alloc_entry alloc_entry;
339 typedef struct quest quest;
340 typedef struct owner_type owner_type;
341 typedef struct store_type store_type;
342 typedef struct magic_type magic_type;
343 typedef struct player_magic player_magic;
344 typedef struct player_sex player_sex;
345 typedef struct player_race player_race;
346 typedef struct player_class player_class;
347 typedef struct hist_type hist_type;
348 typedef struct player_other player_other;
349 typedef struct player_type player_type;
350 typedef struct start_item start_item;
351 typedef struct flavor_type flavor_type;
352 
353 
354 /**** Available Structs ****/
355 
356 /*
357  * Template file header information (see "init.c").  16 bytes.
358  *
359  * Note that the sizes of many of the "arrays" are between 32768 and
360  * 65535, and so we must use "unsigned" values to hold the "sizes" of
361  * these arrays below.  Normally, I try to avoid using unsigned values,
362  * since they can cause all sorts of bizarre problems, but I have no
363  * choice here, at least, until the "race" array is split into "normal"
364  * and "unique" monsters, which may or may not actually help.
365  *
366  * Note that, on some machines, for example, the Macintosh, the standard
367  * "read()" and "write()" functions cannot handle more than 32767 bytes
368  * at one time, so we need replacement functions, see "util.c" for details.
369  *
370  * Note that, on some machines, for example, the Macintosh, the standard
371  * "malloc()" function cannot handle more than 32767 bytes at one time,
372  * but we may assume that the "ralloc()" function can handle up to 65535
373  * butes at one time.  We should not, however, assume that the "ralloc()"
374  * function can handle more than 65536 bytes at a time, since this might
375  * result in segmentation problems on certain older machines, and in fact,
376  * we should not assume that it can handle exactly 65536 bytes at a time,
377  * since the internal functions may use an unsigned short to specify size.
378  *
379  * In general, these problems occur only on machines (such as most personal
380  * computers) which use 2 byte "int" values, and which use "int" for the
381  * arguments to the relevent functions.
382  */
383 
384 typedef errr (*parse_info_txt_func)(char *buf, header *head);
385 
386 struct header
387 {
388 	byte	v_major;		/* Version -- major */
389 	byte	v_minor;		/* Version -- minor */
390 	byte	v_patch;		/* Version -- patch */
391 	byte	v_extra;		/* Version -- extra */
392 
393 
394 	u16b	info_num;		/* Number of "info" records */
395 
396 	u16b	info_len;		/* Size of each "info" record */
397 
398 
399 	u32b	head_size;		/* Size of the "header" in bytes */
400 
401 	u32b	info_size;		/* Size of the "info" array in bytes */
402 
403 	u32b	name_size;		/* Size of the "name" array in bytes */
404 
405 	u32b	text_size;		/* Size of the "text" array in bytes */
406 
407 	void *info_ptr;
408 	char *name_ptr;
409 	char *text_ptr;
410 
411 	parse_info_txt_func parse_info_txt;
412 };
413 
414 
415 /*
416  * Information about maximal indices of certain arrays
417  * Actually, these are not the maxima, but the maxima plus one
418  */
419 
420 struct maxima
421 {
422 	u32b fake_text_size;
423 	u32b fake_name_size;
424 
425 	u16b f_max;		/* Max size for "f_info[]" */
426 	u16b k_max;		/* Max size for "k_info[]" */
427 	u16b a_max;		/* Max size for "a_info[]" */
428 	u16b e_max;		/* Max size for "e_info[]" */
429 	u16b r_max;		/* Max size for "r_info[]" */
430 	u16b v_max;		/* Max size for "v_info[]" */
431 	u16b p_max;		/* Max size for "p_info[]" */
432 	u16b h_max;		/* Max size for "h_info[]" */
433 	u16b b_max;		/* Max size per element of "b_info[]" */
434 	u16b c_max;		/* Max size for "c_info[]" */
435 	u16b flavor_max;	/* Max size for "flavor_info[]" */
436 
437 	u16b o_max;		/* Max size for "o_list[]" */
438 	u16b m_max;		/* Max size for "mon_list[]" */
439 };
440 
441 
442 /*
443  * Information about terrain "features"
444  */
445 
446 struct feature_type
447 {
448 	u32b name;			/* Name (offset) */
449 	u32b text;			/* Text (offset) */
450 
451 	byte mimic;			/* Feature to mimic */
452 
453 	byte extra;			/* Extra byte (unused) */
454 
455 	s16b unused;		/* Extra bytes (unused) */
456 
457 	byte d_attr;		/* Default feature attribute */
458 	char d_char;		/* Default feature character */
459 
460 #if 0
461 /* Unused in MAngband. Use player_type mappings. */
462 	byte x_attr;		/* Desired feature attribute */
463 	char x_char;		/* Desired feature character */
464 #endif
465 };
466 
467 
468 /*
469  * Information about object "kinds", including player knowledge.
470  *
471  * Only "aware" and "tried" are saved in the savefile
472  */
473 struct object_kind
474 {
475 	u32b name;			/* Name (offset) */
476 	u32b text;			/* Text (offset) */
477 
478 	byte tval;			/* Object type */
479 	byte sval;			/* Object sub type */
480 
481 	s16b pval;			/* Object extra info */
482 
483 	s16b to_h;			/* Bonus to hit */
484 	s16b to_d;			/* Bonus to damage */
485 	s16b to_a;			/* Bonus to armor */
486 
487 	s16b ac;			/* Base armor */
488 
489 	byte dd, ds;			/* Damage dice/sides */
490 
491 	s16b weight;			/* Weight */
492 
493 	s32b cost;			/* Object "base cost" */
494 
495 	u32b flags1;			/* Flags, set 1 */
496 	u32b flags2;			/* Flags, set 2 */
497 	u32b flags3;			/* Flags, set 3 */
498 
499 	byte locale[4];			/* Allocation level(s) */
500 	byte chance[4];			/* Allocation chance(s) */
501 
502 	byte level;			/* Level */
503 	byte extra;			/* Something */
504 
505 
506 	byte d_attr;			/* Default object attribute */
507 	char d_char;			/* Default object character */
508 
509 #if 0
510 /* Unused in MAngband. Use player_type mappings. */
511 	byte x_attr;			/* Desired object attribute */
512 	char x_char;			/* Desired object character */
513 #endif
514 
515 	u16b flavor;			/* Special object flavor (or zero) */
516 
517 
518 	bool aware;			/* The player is "aware" of the item's effects */
519 
520 	bool tried;			/* The player has "tried" one of the items */
521 };
522 
523 
524 
525 /*
526  * Information about "artifacts".
527  *
528  * Note that the save-file only writes "cur_num" to the savefile.
529  *
530  * Note that "max_num" is always "1" (if that artifact "exists")
531  */
532 
533 struct artifact_type
534 {
535 	u32b name;			/* Name (offset) */
536 	u32b text;			/* Text (offset) */
537 
538 	byte tval;			/* Artifact type */
539 	byte sval;			/* Artifact sub type */
540 
541 	s16b pval;			/* Artifact extra info */
542 
543 	s16b to_h;			/* Bonus to hit */
544 	s16b to_d;			/* Bonus to damage */
545 	s16b to_a;			/* Bonus to armor */
546 
547 	s16b ac;			/* Base armor */
548 
549 	byte dd, ds;			/* Damage when hits */
550 
551 	s16b weight;			/* Weight */
552 
553 	s32b cost;			/* Artifact "cost" */
554 
555 	u32b flags1;			/* Artifact Flags, set 1 */
556 	u32b flags2;			/* Artifact Flags, set 2 */
557 	u32b flags3;			/* Artifact Flags, set 3 */
558 	u32b flags4;			/* Artifact Flags, set 4 */
559 
560 	byte level;			/* Artifact level */
561 	byte rarity;			/* Artifact rarity */
562 
563 	byte cur_num;			/* Number created (0 or 1) */
564 	byte max_num;			/* Unused (should be "1") */
565 
566 	u16b owner_name;		/* Owner name (index) */
567 	s32b owner_id;			/* His unique id */
568 
569 	byte activation;		/* Activation to use */
570 	u16b time;			/* Activation time */
571 	u16b randtime;			/* Activation time dice */
572 };
573 
574 
575 /*
576  * Information about "ego-items".
577  */
578 
579 struct ego_item_type
580 {
581 	u32b name;			/* Name (offset) */
582 	u32b text;			/* Text (offset) */
583 
584 	s32b cost;			/* Ego-item "cost" */
585 
586 	u32b flags1;			/* Ego-Item Flags, set 1 */
587 	u32b flags2;			/* Ego-Item Flags, set 2 */
588 	u32b flags3;			/* Ego-Item Flags, set 3 */
589 
590 	byte level;			/* Minimum level */
591 	byte rarity;			/* Object rarity */
592 	byte rating;			/* Rating boost */
593 
594 	byte tval[EGO_TVALS_MAX];	/* Possible tval for base item */
595 	byte min_sval[EGO_TVALS_MAX];	/* Mininum sval for base item */
596 	byte max_sval[EGO_TVALS_MAX];	/* Maximum sval for base item */
597 
598 	char max_to_h;			/* Maximum to-hit bonus */
599 	char max_to_d;			/* Maximum to-dam bonus */
600 	char max_to_a;			/* Maximum to-ac bonus */
601 	char max_pval;			/* Maximum pval */
602 
603 	byte xtra;			/* Random powers (sustain, resist, ability) */
604 };
605 
606 
607 
608 
609 /*
610  * Monster blow structure
611  *
612  *	- Method (RBM_*)
613  *	- Effect (RBE_*)
614  *	- Damage Dice
615  *	- Damage Sides
616  */
617 
618 struct monster_blow
619 {
620 	byte method;
621 	byte effect;
622 	byte d_dice;
623 	byte d_side;
624 };
625 
626 
627 
628 /*
629  * Monster "race" information, including racial memories
630  *
631  * Note that "d_attr" and "d_char" are used for MORE than "visual" stuff.
632  *
633  * Note that "x_attr" and "x_char" are used ONLY for "visual" stuff.
634  *
635  * Note that "cur_num" (and "max_num") represent the number of monsters
636  * of the given race currently on (and allowed on) the current level.
637  * This information yields the "dead" flag for Unique monsters.
638  *
639  * Note that "max_num" is reset when a new player is created.
640  * Note that "cur_num" is reset when a new level is created.
641  *
642  * Note that several of these fields, related to "recall", can be
643  * scrapped if space becomes an issue, resulting in less "complete"
644  * monster recall (no knowledge of spells, etc).  All of the "recall"
645  * fields have a special prefix to aid in searching for them.
646  */
647 
648 
649 struct monster_race
650 {
651 	u32b name;				/* Name (offset) */
652 	u32b text;				/* Text (offset) */
653 
654 	byte hdice;				/* Creatures hit dice count */
655 	byte hside;				/* Creatures hit dice sides */
656 
657 	s16b ac;				/* Armour Class */
658 
659 	s16b sleep;				/* Inactive counter (base) */
660 	byte aaf;				/* Area affect radius (1-100) */
661 	byte speed;				/* Speed (normally 110) */
662 
663 	s32b mexp;				/* Exp value for kill */
664 
665 	s16b extra;				/* Unused (for now) */
666 
667 	byte freq_innate;			/* Inate spell frequency */
668 	byte freq_spell;			/* Other spell frequency */
669 
670 	u32b flags1;				/* Flags 1 (general) */
671 	u32b flags2;				/* Flags 2 (abilities) */
672 	u32b flags3;				/* Flags 3 (race/resist) */
673 	u32b flags4;				/* Flags 4 (inate/breath) */
674 	u32b flags5;				/* Flags 5 (normal spells) */
675 	u32b flags6;				/* Flags 6 (special spells) */
676 
677 	monster_blow blow[4];			/* Up to four blows per round */
678 
679 
680 	s16b level;				/* Level of creature */
681 	byte rarity;				/* Rarity of creature */
682 
683 
684 	byte d_attr;			/* Default monster attribute */
685 	char d_char;			/* Default monster character */
686 
687 #if 0
688 /* Unused in MAngband. Use player_type mappings. */
689 	byte x_attr;			/* Desired monster attribute */
690 	char x_char;			/* Desired monster character */
691 #endif
692 
693 	byte max_num;			/* Maximum population allowed per level */
694 	byte cur_num;			/* Monster population on current level */
695 
696 
697 	s16b r_sights;			/* Count sightings of this monster by all players*/
698 	s16b r_tkills;			/* Count monsters killed by all players */
699 
700 	s32b respawn_timer;		/* The amount of time until the unique respawns */
701 };
702 
703 
704 /*
705  * Monster "lore" information
706  *
707  * Note that these fields are related to the "monster recall" and can
708  * be scrapped if space becomes an issue, resulting in less "complete"
709  * monster recall (no knowledge of spells, etc). XXX XXX XXX
710  */
711 struct monster_lore
712 {
713 	s16b sights;			/* Count sightings of this monster */
714 	s16b deaths;			/* Count deaths from this monster */
715 
716 	s16b pkills;			/* Count monsters killed in this life */
717 	s16b tkills;			/* Count monsters killed in all lives */
718 
719 	byte wake;			/* Number of times woken up (?) */
720 	byte ignore;			/* Number of times ignored (?) */
721 
722 	byte xtra1;			/* Something (unused) */
723 	byte xtra2;			/* Something (unused) */
724 
725 	byte drop_gold;			/* Max number of gold dropped at once */
726 	byte drop_item;			/* Max number of item dropped at once */
727 
728 	byte cast_innate;		/* Max number of innate spells seen */
729 	byte cast_spell;		/* Max number of other spells seen */
730 
731 	byte blows[MONSTER_BLOW_MAX];	/* Number of times each blow type was seen */
732 
733 	u32b flags1;			/* Observed racial flags */
734 	u32b flags2;			/* Observed racial flags */
735 	u32b flags3;			/* Observed racial flags */
736 	u32b flags4;			/* Observed racial flags */
737 	u32b flags5;			/* Observed racial flags */
738 	u32b flags6;			/* Observed racial flags */
739 };
740 
741 
742 /*
743  * Information about "vault generation"
744  */
745 
746 struct vault_type
747 {
748 	u32b name;			/* Name (offset) */
749 	u32b text;			/* Text (offset) */
750 
751 	byte typ;			/* Vault type */
752 
753 	byte rat;			/* Vault rating */
754 
755 	byte hgt;			/* Vault height */
756 	byte wid;			/* Vault width */
757 };
758 
759 
760 
761 /*
762  * Structure for an object. (32 bytes)
763  *
764  * Note that a "discount" on an item is permanent and never goes away.
765  *
766  * Note that inscriptions are now handled via the "quark_str()" function
767  * applied to the "note" field, which will return NULL if "note" is zero.
768  *
769  * Note that "object" records are "copied" on a fairly regular basis.
770  *
771  * Note that "object flags" must now be derived from the object kind,
772  * the artifact and ego-item indexes, and the two "xtra" fields.
773  */
774 
775 struct object_type
776 {
777 	s16b k_idx;			/* Kind index (zero if "dead") */
778 
779 	byte iy;			/* Y-position on map, or zero */
780 	byte ix;			/* X-position on map, or zero */
781 
782 	s16b dun_depth;			/* Depth into the dungeon */
783 
784 	byte tval;			/* Item type (from kind) */
785 	byte sval;			/* Item sub-type (from kind) */
786 
787 	s32b bpval;			/* Base item extra-parameter */
788 	s32b pval;			/* Extra enchantment item extra-parameter */
789 
790 	byte discount;			/* Discount (if any) */
791 
792 	byte number;			/* Number of items */
793 
794 	s16b weight;			/* Item weight */
795 
796 	byte name1;			/* Artifact type, if any */
797 	byte name2;			/* Ego-Item type, if any */
798 	s32b name3;			/* Randart seed, if any */
799 
800 	byte xtra1;			/* Extra info type */
801 	byte xtra2;			/* Extra info index */
802 
803 	s16b to_h;			/* Plusses to hit */
804 	s16b to_d;			/* Plusses to damage */
805 	s16b to_a;			/* Plusses to AC */
806 
807 	s16b ac;			/* Normal AC */
808 
809 	byte dd, ds;			/* Damage dice/sides */
810 
811 	s16b timeout;			/* Timeout Counter */
812 
813 	byte ident;			/* Special flags  */
814 	s32b askprice;			/* Item sale price */
815 
816 	/*byte marked;*/		/* Object is marked */
817 	u16b owner_name;		/* Owner name (index) */
818 	s32b owner_id;			/* His unique id */
819 
820 	u16b note;			/* Inscription index */
821 
822 	s16b next_o_idx;		/* Next object in stack (if any) */
823 	s16b held_m_idx;		/* Monster holding us (if any) */
824 
825 	byte origin;        /* How this item was found */
826 	byte origin_depth;  /* What depth the item was found at */
827 	u16b origin_xtra;   /* Extra information about origin */
828 	u16b origin_player; /* MAngband-specific: Original owner */
829 };
830 
831 
832 
833 /*
834  * Monster information, for a specific monster.
835  *
836  * Note: fy, fx constrain dungeon size to 256x256
837  */
838 
839 struct monster_type
840 {
841 	s16b r_idx;			/* Monster race index */
842 
843 	byte fy;			/* Y location on map */
844 	byte fx;			/* X location on map */
845 	byte wx;			/* Wanderers X target on map */
846 	byte wy;			/* Wanderers Y target on map */
847 
848 	s16b dun_depth;			/* Level of the dungeon */
849 
850 	s16b hp;			/* Current Hit points */
851 	s16b maxhp;			/* Max Hit points */
852 
853 	s16b csleep;			/* Inactive counter */
854 
855 	byte mspeed;			/* Monster "speed" */
856 	s64b energy;			/* Monster "energy" */
857 
858 	byte stunned;			/* Monster is stunned */
859 	byte confused;			/* Monster is confused */
860 	byte monfear;			/* Monster is afraid */
861 
862 	byte cdis;			/* Current dis from player */
863 
864 /*	bool los;*/			/* Monster is "in sight" */
865 /*	bool ml;*/			/* Monster is "visible" */
866 
867 	s16b closest_player;		/* The player closest to this monster */
868 	s16b hold_o_idx;		/* Object being helf (if any) */
869 #ifdef WDT_TRACK_OPTIONS
870 
871 	byte ty;			/* Y location of target */
872 	byte tx;			/* X location of target */
873 
874 	byte t_dur;			/* How long are we tracking */
875 
876 	byte t_bit;			/* Up to eight bit flags */
877 
878 #endif
879 
880 #ifdef DRS_SMART_OPTIONS
881 
882 	u32b smart;			/* Field for "smart_learn" */
883 
884 #endif
885 	u16b mimic_k_idx;		/* Which object kind it pretends to be. 0 if none. */
886 };
887 
888 
889 
890 /*
891  * An entry for the object/monster allocation functions
892  *
893  * Pass 1 is determined from allocation information
894  * Pass 2 is determined from allocation restriction
895  * Pass 3 is determined from allocation calculation
896  */
897 
898 struct alloc_entry
899 {
900 	s16b index;		/* The actual index */
901 
902 	s16b level;		/* Base dungeon level */
903 	byte prob1;		/* Probability, pass 1 */
904 	byte prob2;		/* Probability, pass 2 */
905 	byte prob3;		/* Probability, pass 3 */
906 
907 	u16b total;		/* Unused for now */
908 };
909 
910 
911 /*
912  * Structure for the "quests"
913  *
914  * Hack -- currently, only the "level" parameter is set, with the
915  * semantics that "one (QUEST) monster of that level" must be killed,
916  * and then the "level" is reset to zero, meaning "all done".  Later,
917  * we should allow quests like "kill 100 fire hounds", and note that
918  * the "quest level" is then the level past which progress is forbidden
919  * until the quest is complete.  Note that the "QUESTOR" flag then could
920  * become a more general "never out of depth" flag for monsters.
921  *
922  * Actually, in Angband 2.8.0 it will probably prove easier to restrict
923  * the concept of quest monsters to specific unique monsters, and to
924  * actually scan the dead unique list to see what quests are left.
925  */
926 
927 struct quest
928 {
929 	int level;		/* Dungeon level */
930 	int r_idx;		/* Monster race */
931 
932 	int cur_num;		/* Number killed (unused) */
933 	int max_num;		/* Number required (unused) */
934 };
935 
936 
937 /*
938  * A store owner
939  */
940 
941 struct owner_type
942 {
943 	u32b owner_name;	/* Name */
944 
945 	s32b max_cost;		/* Purse limit */
946 
947 	byte max_inflate;	/* Inflation (max) */
948 	byte min_inflate;	/* Inflation (min) */
949 
950 	byte haggle_per;	/* Haggle unit */
951 
952 	byte insult_max;	/* Insult limit */
953 
954 	byte owner_race;	/* Owner race */
955 
956 	byte unused;		/* Unused */
957 };
958 
959 
960 
961 
962 /*
963  * A store, with an owner, various state flags, a current stock
964  * of items, and a table of items that are often purchased.
965  */
966 
967 struct store_type
968 {
969 	byte owner;			/* Owner index */
970 	byte extra;			/* Unused for now */
971 
972 	s16b insult_cur;		/* Insult counter */
973 
974 	s16b good_buy;			/* Number of "good" buys */
975 	s16b bad_buy;			/* Number of "bad" buys */
976 
977 	hturn store_open;		/* Closed until this turn */
978 
979 	s32b store_wrap;		/* Unused for now */
980 
981 	s16b table_num;			/* Table -- Number of entries */
982 	s16b table_size;		/* Table -- Total Size of Array */
983 	s16b *table;			/* Table -- Legal item kinds */
984 
985 	s16b stock_num;			/* Stock -- Number of entries */
986 	s16b stock_size;		/* Stock -- Total Size of Array */
987 	object_type *stock;		/* Stock -- Actual stock items */
988 };
989 
990 
991 
992 
993 
994 /*
995  * The "name" of spell 'N' is stored as spell_names[X][N],
996  * where X is 0 for mage-spells and 1 for priest-spells.
997  */
998 
999 struct magic_type
1000 {
1001 	byte slevel;			/* Required level (to learn) */
1002 	byte smana;			/* Required mana (to cast) */
1003 	byte sfail;			/* Minimum chance of failure */
1004 	byte sexp;			/* Encoded experience bonus */
1005 };
1006 
1007 
1008 /*
1009  * Information about the player's "magic"
1010  *
1011  * Note that a player with a "spell_book" of "zero" is illiterate.
1012  */
1013 
1014 struct player_magic
1015 {
1016 	magic_type info[PY_MAX_SPELLS];	/* The available spells */
1017 };
1018 
1019 
1020 
1021 /*
1022  * Player sex info
1023  */
1024 
1025 struct player_sex
1026 {
1027 	cptr title;			/* Type of sex */
1028 
1029 	cptr winner;			/* Name of winner */
1030 };
1031 
1032 
1033 /*
1034  * Player racial info
1035  */
1036 
1037 struct player_race
1038 {
1039 	u32b name;			/* Name (offset) */
1040 	u32b text;			/* Text (offset) */
1041 
1042 	s16b r_adj[6];		/* Racial stat bonuses */
1043 
1044 	s16b r_dis;			/* disarming */
1045 	s16b r_dev;			/* magic devices */
1046 	s16b r_sav;			/* saving throw */
1047 	s16b r_stl;			/* stealth */
1048 	s16b r_srh;			/* search ability */
1049 	s16b r_fos;			/* search frequency */
1050 	s16b r_thn;			/* combat (normal) */
1051 	s16b r_thb;			/* combat (shooting) */
1052 
1053 	byte r_mhp;			/* Race hit-dice modifier */
1054 	s16b r_exp;			/* Race experience factor */
1055 
1056 	byte b_age;			/* base age */
1057 	byte m_age;			/* mod age */
1058 
1059 	byte m_b_ht;		/* base height (males) */
1060 	byte m_m_ht;		/* mod height (males) */
1061 	byte m_b_wt;		/* base weight (males) */
1062 	byte m_m_wt;		/* mod weight (males) */
1063 
1064 	byte f_b_ht;		/* base height (females) */
1065 	byte f_m_ht;		/* mod height (females) */
1066 	byte f_b_wt;		/* base weight (females) */
1067 	byte f_m_wt;		/* mod weight (females) */
1068 
1069 	byte infra;			/* Infra-vision range */
1070 
1071 	byte choice;			/* Legal class choices */
1072 
1073 	s16b hist;			/* Starting history index */
1074 
1075 	u32b flags1;		/* Racial Flags, set 1 */
1076 	u32b flags2;		/* Racial Flags, set 2 */
1077 	u32b flags3;		/* Racial Flags, set 3 */
1078 };
1079 
1080 
1081 /*
1082  * Starting equipment entry
1083  */
1084 struct start_item
1085 {
1086 	byte tval;	/* Item's tval */
1087 	byte sval;	/* Item's sval */
1088 	byte min;	/* Minimum starting amount */
1089 	byte max;	/* Maximum starting amount */
1090 };
1091 
1092 
1093 /*
1094  * Player class info
1095  */
1096 struct player_class
1097 {
1098 	u32b name;		/* Name (offset) */
1099 
1100 	u32b title[10];		/* Titles - offset */
1101 
1102 	s16b c_adj[A_CAP];	/* Class stat modifier */
1103 
1104 	s16b c_dis;			/* class disarming */
1105 	s16b c_dev;			/* class magic devices */
1106 	s16b c_sav;			/* class saving throws */
1107 	s16b c_stl;			/* class stealth */
1108 	s16b c_srh;			/* class searching ability */
1109 	s16b c_fos;			/* class searching frequency */
1110 	s16b c_thn;			/* class to hit (normal) */
1111 	s16b c_thb;			/* class to hit (bows) */
1112 
1113 	s16b x_dis;			/* extra disarming */
1114 	s16b x_dev;			/* extra magic devices */
1115 	s16b x_sav;			/* extra saving throws */
1116 	s16b x_stl;			/* extra stealth */
1117 	s16b x_srh;			/* extra searching ability */
1118 	s16b x_fos;			/* extra searching frequency */
1119 	s16b x_thn;			/* extra to hit (normal) */
1120 	s16b x_thb;			/* extra to hit (bows) */
1121 
1122 	s16b c_mhp;			/* Class hit-dice adjustment */
1123 	s16b c_exp;			/* Class experience factor */
1124 
1125 	u32b flags;			/* Class Flags */
1126 
1127 	u16b max_attacks;	/* Maximum possible attacks */
1128 	u16b min_weight;	/* Minimum weapon weight for calculations */
1129 	u16b att_multiply;	/* Multiplier for attack calculations */
1130 
1131 	byte spell_book;	/* Tval of spell books (if any) */
1132 	u16b spell_stat;	/* Stat for spells (if any) */
1133 	u16b spell_first;	/* Level of first spell */
1134 	u16b spell_weight;	/* Weight that hurts spells */
1135 
1136 	u32b sense_base;	/* Base pseudo-id value */
1137 	u16b sense_div;		/* Pseudo-id divisor */
1138 
1139 	start_item start_items[MAX_START_ITEMS];/* The starting inventory */
1140 
1141 	player_magic spells;	/* Magic spells */
1142 
1143 	byte attr;		/* Class color */
1144 };
1145 
1146 
1147 /*
1148  * Player background information
1149  */
1150 struct hist_type
1151 {
1152 	u32b text;			    /* Text (offset) */
1153 
1154 	byte roll;			    /* Frequency of this entry */
1155 	byte chart;			    /* Chart index */
1156 	byte next;			    /* Next chart index */
1157 	byte bonus;			    /* Social Class Bonus + 50 */
1158 };
1159 
1160 
1161 /*
1162  * Some more player information
1163  *
1164  * This information is retained across player lives
1165  */
1166 struct player_other
1167 {
1168 	char full_name[32];		/* Full name */
1169 	char base_name[32];		/* Base name */
1170 
1171 	bool opt[MAX_OPTIONS];		/* Options */
1172 
1173 	u32b window_flag[ANGBAND_TERM_MAX];	/* Window flags */
1174 
1175 	byte hitpoint_warn;		/* Hitpoint warning (0 to 9) */
1176 
1177 	byte delay_factor;		/* Delay factor (0 to 9) */
1178 };
1179 
1180 
1181 /*
1182  * Most of the "player" information goes here.
1183  *
1184  * This stucture gives us a large collection of player variables.
1185  *
1186  * This structure contains several "blocks" of information.
1187  *   (1) the "permanent" info
1188  *   (2) the "variable" info
1189  *   (3) the "transient" info
1190  *
1191  * All of the "permanent" info, and most of the "variable" info,
1192  * is saved in the savefile.  The "transient" info is recomputed
1193  * whenever anything important changes.
1194  */
1195 
1196 
1197 struct player_type
1198 {
1199 	int conn;			/* Connection number */
1200 	int Ind;			/* Players[] array index, or 0 */
1201 	char name[MAX_CHARS];		/* Nickname */
1202 	char pass[MAX_CHARS];		/* Password */
1203 	char basename[MAX_CHARS];
1204 	char realname[MAX_CHARS];	/* Userid */
1205 	char hostname[MAX_CHARS];	/* His hostname */
1206 	char addr[MAX_CHARS];		/* His IP address */
1207 	unsigned int version;		/* His version */
1208 
1209 	int state;	/* Player state, see "pack.h" */
1210 	int idle;	/* Number of seconds since last network packet */
1211 	int afk_seconds; /* Number of seconds since last game command */
1212 	cq cbuf;	/* Command Queue */
1213 
1214 	s32b id;		/* Unique ID to each player */
1215 
1216 	hostile_type *hostile;	/* List of players we wish to attack */
1217 
1218 	char savefile[1024];	/* Name of the savefile */
1219 	int stat_order[A_CAP];
1220 
1221 	int infodata_sent[6];
1222 	bool supports_slash_fx;
1223 
1224 	bool alive;		/* Are we alive */
1225 	bool death;		/* Have we died */
1226 	s16b ghost;		/* Are we a ghost */
1227 	s16b fruit_bat;		/* Are we a fruit bat */
1228 	byte lives;		/* number of times we have ressurected */
1229 	byte new_game;		/* Are we beginning a new game? */
1230 
1231 	byte prace;			/* Race index */
1232 	byte pclass;			/* Class index */
1233 	byte male;			/* Sex of character */
1234 	byte oops;			/* Unused */
1235 
1236 	u32b dm_flags;	/* Dungeon Master Flags */
1237 
1238 	byte hitdie;		/* Hit dice (sides) */
1239 	s16b expfact;		/* Experience factor */
1240 
1241 	byte maximize;		/* Maximize stats */
1242 	byte preserve;		/* Preserve artifacts */
1243 
1244 	s16b age;			/* Characters age */
1245 	s16b ht;			/* Height */
1246 	s16b wt;			/* Weight */
1247 	s16b sc;			/* Social Class */
1248 
1249 
1250 	player_race *rp_ptr;		/* Pointers to player tables */
1251 	player_class *cp_ptr;
1252 	player_magic *mp_ptr;
1253 
1254 	s32b au;			/* Current Gold */
1255 
1256 	s32b max_exp;			/* Max experience */
1257 	s32b exp;			/* Cur experience */
1258 	u16b exp_frac;			/* Cur exp frac (times 2^16) */
1259 
1260 	s16b lev;			/* Level */
1261 
1262 	s16b mhp;			/* Max hit pts */
1263 	s16b chp;			/* Cur hit pts */
1264 	u16b chp_frac;			/* Cur hit frac (times 2^16) */
1265 
1266 	s16b player_hp[PY_MAX_LEVEL];
1267 
1268 	s16b msp;			/* Max mana pts */
1269 	s16b csp;			/* Cur mana pts */
1270 	u16b csp_frac;			/* Cur mana frac (times 2^16) */
1271 
1272 	object_type *inventory;	/* Player's inventory */
1273 	s16b delta_floor_item;	/* Player is standing on.. */
1274 
1275 	s16b total_weight;	/* Total weight being carried */
1276 
1277 	s16b inven_cnt;		/* Number of items in inventory */
1278 	s16b equip_cnt;		/* Number of items in equipment */
1279 	bool prevents[128];	/* Cache of "^" inscriptions */
1280 
1281 	s16b max_plv;		/* Max Player Level */
1282 	s16b max_dlv;		/* Max level explored */
1283 	s16b recall_depth;	/* which depth to recall to */
1284 
1285 	s16b stat_max[6];	/* Current "maximal" stat values */
1286 	s16b stat_cur[6];	/* Current "natural" stat values */
1287 
1288 	char history[4][60];	/* The player's "history" */
1289 	char descrip[4 *60];	/* Same, but in 3rd person */
1290 	cave_view_type hist_flags[14][39];	/* Player' sustains/restists/flags */
1291 
1292 	s16b world_x;	/* The wilderness x coordinate */
1293 	s16b world_y;	/* The wilderness y coordinate */
1294 
1295 	unsigned char wild_map[(MAX_WILD/8)];	/* the wilderness we have explored */
1296 
1297 	s16b py;		/* Player location in dungeon */
1298 	s16b px;
1299 	s16b dun_depth;		/* Player depth -- wilderness level offset */
1300 
1301 	s16b cur_hgt;		/* Height and width of their dungeon level */
1302 	s16b cur_wid;
1303 
1304 	bool new_level_flag;	/* Has this player changed depth? */
1305 	byte new_level_method;	/* Climb up stairs, down, or teleport level? */
1306 
1307 	byte party;		/* The party he belongs to (or 0 if neutral) */
1308 
1309 	bool target_set;
1310 	s32b target_who;
1311 	s16b target_col;	/* What position is targetted */
1312 	s16b target_row;
1313 
1314 	s16b target_flag;	/* Arbitary grids OR Intersting grids */
1315 	u16b look_index;	/* Index of interesting grid */
1316 	byte look_y;		/* Row of arbitary grid */
1317 	byte look_x;		/* Col of arbitary grid */
1318 
1319 	s16b health_who;	/* Who's shown on the health bar */
1320 	s16b cursor_who;	/* Who's tracked by cursor */
1321 	s16b monster_race_idx; /* Monster race trackee */
1322 	s16b old_monster_race_idx; /* Old Monster race trackee ? */
1323 
1324 	s16b view_n;		/* Array of grids viewable to player */
1325 	byte view_y[VIEW_MAX];
1326 	byte view_x[VIEW_MAX];
1327 
1328 	s16b lite_n;		/* Array of grids lit by player lite */
1329 	byte lite_y[LITE_MAX];
1330 	byte lite_x[LITE_MAX];
1331 
1332 	s16b temp_n;		/* Array of grids used for various things */
1333 	byte temp_y[TEMP_MAX];
1334 	byte temp_x[TEMP_MAX];
1335 
1336 	s16b target_n;		/* Array of grids used for targetting/looking */
1337 	byte target_y[TEMP_MAX];
1338 	byte target_x[TEMP_MAX];
1339 	s16b target_idx[TEMP_MAX];
1340 
1341 	byte special_handler;	/* Which custom command is handling interactive terminal? */
1342 	byte special_file_type;	/* Is he using *ID* or Self Knowledge? */
1343 	s16b interactive_line;	/* Which line is he on? */
1344 	cptr interactive_file;	/* Which file is he reading? */
1345 	s16b interactive_next;	/* Which line is he on 'in the file' ? */
1346 	s16b interactive_size;	/* Total number of lines in file */
1347 	char interactive_hook[26][32];	/* Sub-menu information */
1348 
1349 	byte cave_flag[MAX_HGT][MAX_WID]; /* Can the player see this grid? */
1350 
1351 	bool mon_hrt[MAX_M_IDX]; /* Have this player hurt these monsters? */
1352 
1353 	bool mon_vis[MAX_M_IDX];  /* Can this player see these monsters? */
1354 	bool mon_los[MAX_M_IDX];
1355 	byte mon_det[MAX_M_IDX]; /* Were these monsters detected by this player? */
1356 
1357 	bool obj_vis[MAX_O_IDX];  /* Can this player see these objcets? */
1358 
1359 	bool play_vis[MAX_PLAYERS];	/* Can this player see these players? */
1360 	bool play_los[MAX_PLAYERS];
1361 	byte play_det[MAX_PLAYERS]; /* Were these players detected by this player? */
1362 
1363 	bool *kind_aware; /* Is the player aware of this obj kind? */
1364 	bool *kind_tried; /* Has the player tried this obj kind? */
1365 
1366 	monster_lore *l_list; /* Character's monster lore */
1367 	monster_lore old_l; /* Old monster lore (for delta checks) */
1368 
1369 	bool options[MAX_OPTIONS];	/* Player's options */
1370 	byte hitpoint_warn;
1371 	byte *d_attr;
1372 	char *d_char;
1373 	byte *k_attr;
1374 	char *k_char;
1375 	byte *r_attr;
1376 	char *r_char;
1377 	byte *f_attr;
1378 	char *f_char;
1379 	byte flvr_attr[MAX_FLVR_IDX];
1380 	char flvr_char[MAX_FLVR_IDX];
1381 	byte misc_attr[1024];
1382 	char misc_char[1024];
1383 	byte tval_attr[128];
1384 	char tval_char[128];
1385 	byte *pr_attr;
1386 	char *pr_char;
1387 
1388 	byte dungeon_stream;
1389 	int use_graphics;
1390 	s16b graf_lit_offset[LIGHTING_MAX][2];
1391 	byte screen_wid;
1392 	byte screen_hgt;
1393 
1394 	s16b max_panel_rows;
1395 	s16b max_panel_cols;
1396 	s16b panel_row;
1397 	s16b panel_col;
1398 	s16b panel_row_min;
1399 	s16b panel_row_max;
1400 	s16b panel_col_min;
1401 	s16b panel_col_max;
1402 	s16b panel_col_prt;	/* What panel this guy's on */
1403 	s16b panel_row_prt;
1404 	s16b panel_row_old;
1405 	s16b panel_col_old;
1406 
1407 	byte stream_wid[MAX_STREAMS]; /* Client's chosen stream output size (or default..?) */
1408 	byte stream_hgt[MAX_STREAMS]; /* Set 'height' to 0 to disable stream completly */
1409 	cave_view_type* stream_cave[MAX_STREAMS]; /* Helper array of stream-to-cave pointers */
1410 				/* What he should be seeing */
1411 	cave_view_type scr_info[MAX_HGT][MAX_WID];
1412 	cave_view_type trn_info[MAX_HGT][MAX_WID];
1413 	cave_view_type info[MAX_TXT_INFO][MAX_WID];
1414 	cave_view_type file[MAX_TXT_INFO][MAX_WID];
1415 	s16b last_info_line; /* (number of lines - 1) */
1416 	s16b last_file_line; /* (number of lines - 1) */
1417 	byte remote_term;
1418 	u32b window_flag; /* What updates is he subscribed to? */
1419 
1420 
1421 	char died_from[80];     	/* What off-ed him */
1422 	char died_from_list[80];	/* what goes on the high score list */
1423 	s16b died_from_depth;   	/* what depth we died on */
1424 
1425 	char msg_log[MAX_MSG_HIST][MAX_CHARS];	/* Message history log */
1426 	s16b msg_hist_ptr;	/* Where will the next message be stored */
1427 	s16b msg_hist_dupe;	/* Count duplicate messages for collapsing */
1428 	u16b msg_last_type;	/* Last message type sent */
1429 
1430 	history_event *charhist; /* Character event history */
1431 
1432 	u16b main_channel; /* main chat channel the player is in */
1433 	char second_channel[MAX_CHARS]; /* where his legacy 'privates' are sent */
1434 	byte on_channel[MAX_CHANNELS]; /* listening to what channels */
1435 
1436 	u16b total_winner;	/* Is this guy the winner */
1437 	u16b retire_timer;	/* The number of minutes this guy can play until
1438 				   he will be forcibly retired.
1439 				 */
1440 
1441 	u16b noscore;		/* Has he cheated in some way (hopefully not) */
1442 	s16b command_rep;	/* Command repetition */
1443 
1444 	byte last_dir;		/* Last direction moved (used for swapping places) */
1445 
1446 	s16b running;		/* Are we running */
1447 	byte find_current;	/* These are used for the running code */
1448 	byte find_prevdir;
1449 	byte run_request;
1450 	byte ran_tiles;
1451 	bool find_openarea;
1452 	bool find_breakright;
1453 	bool find_breakleft;
1454 
1455 	bool running_withpathfind;
1456 	char pf_result[MAX_PF_LENGTH];
1457 	int pf_result_index;
1458 
1459 	bool resting;		/* Are we resting? */
1460 
1461 	s16b command_dir;	/* Direction being used */
1462 	s16b command_arg;	/* Item being used */
1463 	s16b current_object;	/* Object being cast (primary) */
1464 	s16b current_spell;	/* Spell being cast */
1465 
1466 	s16b current_selling;
1467 	s16b current_sell_amt;
1468 	int current_sell_price;
1469 
1470 	int current_house; /* Which house is he pointing */
1471 	int store_num;		/* What store this guy is in */
1472 	int player_store_num;		/* What player store this guy is in */
1473 	int arena_num;		/* What arena this guy is in */
1474 
1475 	u32b image_seed;		/* Hack -- hallucination seed */
1476 	u32b hallu_offset;		/* Hack -- hallucination RNG offset */
1477 
1478 	s16b fast;			/* Timed -- Fast */
1479 	s16b slow;			/* Timed -- Slow */
1480 	s16b blind;			/* Timed -- Blindness */
1481 	s16b paralyzed;			/* Timed -- Paralysis */
1482 	s16b confused;			/* Timed -- Confusion */
1483 	s16b afraid;			/* Timed -- Fear */
1484 	s16b image;			/* Timed -- Hallucination */
1485 	s16b poisoned;			/* Timed -- Poisoned */
1486 	s16b cut;			/* Timed -- Cut */
1487 	s16b stun;			/* Timed -- Stun */
1488 
1489 	s16b protevil;		/* Timed -- Protection */
1490 	s16b invuln;		/* Timed -- Invulnerable */
1491 	s16b hero;		/* Timed -- Heroism */
1492 	s16b shero;		/* Timed -- Super Heroism */
1493 	s16b shield;		/* Timed -- Shield Spell */
1494 	s16b blessed;		/* Timed -- Blessed */
1495 	s16b tim_invis;		/* Timed -- See Invisible */
1496 	s16b tim_infra;		/* Timed -- Infra Vision */
1497 
1498 	s16b oppose_acid;	/* Timed -- oppose acid */
1499 	s16b oppose_elec;	/* Timed -- oppose lightning */
1500 	s16b oppose_fire;	/* Timed -- oppose heat */
1501 	s16b oppose_cold;	/* Timed -- oppose cold */
1502 	s16b oppose_pois;	/* Timed -- oppose poison */
1503 
1504 	s16b word_recall;	/* Word of recall counter */
1505 
1506 	u32b energy;		/* Current energy */
1507 	u32b energy_buildup;	/* MAngband-specific: bonus energy (!) */
1508 
1509 	byte dealt_blows;	/* Temp -- count blows this round */
1510 
1511 	s16b food;		/* Current nutrition */
1512 
1513 	byte confusing;		/* Glowing hands */
1514 	byte searching;		/* Currently searching */
1515 
1516 	s16b new_spells;	/* Number of spells available */
1517 
1518 	s16b old_spells;
1519 
1520 	byte spell_flags[PY_MAX_SPELLS]; /* Spell Flags for learned/tried/forgotten */
1521 	byte spell_order[PY_MAX_SPELLS]; /* order spells learned/remembered/fogotten */
1522 
1523 	bool old_cumber_armor;
1524 	bool old_cumber_glove;
1525 	bool old_heavy_wield;
1526 	bool old_heavy_shoot;
1527 	bool old_icky_wield;
1528 
1529 	s16b old_lite;		/* Old radius of lite (if any) */
1530 	s16b old_view;		/* Old radius of view (if any) */
1531 
1532 	s16b old_food_aux;	/* Old value of food */
1533 
1534 
1535 	bool cumber_armor;	/* Mana draining armor */
1536 	bool cumber_glove;	/* Mana draining gloves */
1537 	bool heavy_wield;	/* Heavy weapon */
1538 	bool heavy_shoot;	/* Heavy shooter */
1539 	bool icky_wield;	/* Icky weapon */
1540 
1541 	s16b cur_lite;		/* Radius of lite (if any) */
1542 	s16b noise;		/* Timed -- Noise level (for stealth checks) */
1543 
1544 	u32b notice;		/* Special Updates (bit flags) */
1545 	u32b update;		/* Pending Updates (bit flags) */
1546 	u64b redraw;		/* Normal Redraws (bit flags) */
1547 	u32b window;		/* Window Redraws (bit flags) */
1548 	u64b redraw_inven;	/* Inventory slots Redraws (bit flags) */
1549 
1550 	s16b stat_use[A_CAP];	/* Current modified stats */
1551 	s16b stat_top[A_CAP];	/* Maximal modified stats */
1552 
1553 	s16b stat_add[A_CAP];	/* Modifiers to stat values */
1554 	s16b stat_ind[A_CAP];	/* Indexes into stat tables */
1555 
1556 	bool immune_acid;	/* Immunity to acid */
1557 	bool immune_elec;	/* Immunity to lightning */
1558 	bool immune_fire;	/* Immunity to fire */
1559 	bool immune_cold;	/* Immunity to cold */
1560 
1561 	bool resist_acid;	/* Resist acid */
1562 	bool resist_elec;	/* Resist lightning */
1563 	bool resist_fire;	/* Resist fire */
1564 	bool resist_cold;	/* Resist cold */
1565 	bool resist_pois;	/* Resist poison */
1566 
1567 	bool resist_conf;	/* Resist confusion */
1568 	bool resist_sound;	/* Resist sound */
1569 	bool resist_lite;	/* Resist light */
1570 	bool resist_dark;	/* Resist darkness */
1571 	bool resist_chaos;	/* Resist chaos */
1572 	bool resist_disen;	/* Resist disenchant */
1573 	bool resist_shard;	/* Resist shards */
1574 	bool resist_nexus;	/* Resist nexus */
1575 	bool resist_blind;	/* Resist blindness */
1576 	bool resist_neth;	/* Resist nether */
1577 	bool resist_fear;	/* Resist fear */
1578 
1579 	bool sustain_str;	/* Keep strength */
1580 	bool sustain_int;	/* Keep intelligence */
1581 	bool sustain_wis;	/* Keep wisdom */
1582 	bool sustain_dex;	/* Keep dexterity */
1583 	bool sustain_con;	/* Keep constitution */
1584 	bool sustain_chr;	/* Keep charisma */
1585 
1586 	bool aggravate;		/* Aggravate monsters */
1587 	bool teleport;		/* Random teleporting */
1588 
1589 	bool exp_drain;		/* Experience draining */
1590 
1591 	bool feather_fall;	/* No damage falling */
1592 	bool lite;		/* Permanent light */
1593 	bool free_act;		/* Never paralyzed */
1594 	bool see_inv;		/* Can see invisible */
1595 	bool regenerate;	/* Regenerate hit pts */
1596 	bool hold_life;		/* Resist life draining */
1597 	u32b telepathy;		/* Telepathy */
1598 	bool slow_digest;	/* Slower digestion */
1599 	bool bless_blade;	/* Blessed blade */
1600 	bool xtra_might;	/* Extra might bow */
1601 	bool impact;		/* Earthquake blows */
1602 
1603 	s16b dis_to_h;		/* Known bonus to hit */
1604 	s16b dis_to_d;		/* Known bonus to dam */
1605 	s16b dis_to_a;		/* Known bonus to ac */
1606 
1607 	s16b dis_ac;		/* Known base ac */
1608 
1609 	s16b to_h;			/* Bonus to hit */
1610 	s16b to_d;			/* Bonus to dam */
1611 	s16b to_a;			/* Bonus to ac */
1612 
1613 	s16b ac;			/* Base ac */
1614 
1615 	s16b see_infra;		/* Infravision range */
1616 
1617 	s16b skill_dis;		/* Skill: Disarming */
1618 	s16b skill_dev;		/* Skill: Magic Devices */
1619 	s16b skill_sav;		/* Skill: Saving throw */
1620 	s16b skill_stl;		/* Skill: Stealth factor */
1621 	s16b skill_srh;		/* Skill: Searching ability */
1622 	s16b skill_fos;		/* Skill: Searching frequency */
1623 	s16b skill_thn;		/* Skill: To hit (normal) */
1624 	s16b skill_thb;		/* Skill: To hit (shooting) */
1625 	s16b skill_tht;		/* Skill: To hit (throwing) */
1626 	s16b skill_dig;		/* Skill: Digging */
1627 
1628 	s16b num_blow;		/* Number of blows */
1629 	s16b num_fire;		/* Number of shots */
1630 
1631 	byte tval_xtra;		/* Correct xtra tval */
1632 
1633 	byte tval_ammo;		/* Correct ammo tval */
1634 
1635 	s16b pspeed;		/* Current speed */
1636 
1637 	s16b *r_killed;		/* Monsters killed */
1638 	s16b feeling;		/* Most recent feeling */
1639 
1640 	hturn birth_turn;	/* Server turn on which player was born */
1641 	hturn turn;		/* Actual player turns */
1642 	hturn old_turn;		/* Turn when player entered current level */
1643 	hturn last_turn;	/* Last server turn this player has seen */
1644 
1645 	byte *a_info; /* Artifacts player has encountered */
1646 	quest q_list[MAX_Q_IDX]; /* Quests completed by player */
1647 	bool in_hack;		/* Temporary flag, not guaranteed to stay same between function calls */
1648 
1649 	bool bubble_checked;	/* Have we been included in a time bubble check? */
1650 	s32b bubble_speed;		/* What was our last time bubble scale factor */
1651 	hturn bubble_change;		/* Server turn we last changed colour */
1652 	byte bubble_colour;		/* Current warning colour for slow time bubbles */
1653 
1654 	bool project_hurt;		/* Player has been hurt in project_p() */
1655 
1656 	byte master_hook[MASTER_MAX_HOOKS];	/* Dungeon Master hook slots */
1657 	u32b master_args[MASTER_MAX_HOOKS];	/* Arguments for the hooks */
1658 	u32b master_parm;		/* Page settings (DM menu) or brush flags */
1659 	byte master_flag;		/* Currently selected brush (in DM menu) */
1660 };
1661 
1662 
1663 struct flavor_type
1664 {
1665 	u32b text;      /* Text (offset) */
1666 
1667 	byte tval;      /* Associated object type */
1668 	byte sval;      /* Associated object sub-type */
1669 
1670 	byte d_attr;    /* Default flavor attribute */
1671 	char d_char;    /* Default flavor character */
1672 #if 0
1673 /* Unused in MAngband. Use player_type mappings. */
1674 	byte x_attr;    /* Desired flavor attribute */
1675 	char x_char;    /* Desired flavor character */
1676 #endif
1677 };
1678 
1679 
1680 typedef int (*cccb)	(void); /* "Custom Command Call-Back" */
1681 struct custom_command_type
1682 {
1683 	char m_catch;   	/* Actual command (such as 'j'). */
1684 	char pkt;
1685 	byte scheme;
1686 	byte energy_cost;	/* In 1/Nth of level_speed; 0 == free */
1687 	cccb do_cmd_callback;
1688 
1689 	u32b flag;
1690 	byte tval;
1691 	char prompt[MSG_LEN];
1692 	char display[MAX_CHARS];
1693 };
1694 
1695 /*
1696  * Data streams
1697  */
1698 struct stream_type
1699 {
1700 	byte pkt;       	/* Network packet used for it */
1701 
1702 	byte addr;      	/* Destination "window" */
1703 
1704 	byte rle;       	/* RLE mode */
1705 	byte flag;      	/* Important flags (i.e. transperancy) */
1706 
1707 	u16b min_row;   	/* Size */
1708 	byte min_col;
1709 	u16b max_row;
1710 	byte max_col;
1711 
1712 	u32b window_flag;	/* "Window" flag */
1713 	cptr mark;      	/* Hack -- debug/internal name */
1714 	cptr window_desc;	/* Display name */
1715 };
1716 
1717 struct indicator_type
1718 {
1719 	byte pkt;   	/* Network packet used for it */
1720 	byte type;  	/* Variable type (int, string, etc...; see INDITYPE_ defines) */
1721 	byte amnt;  	/* Ammount of variables (or offset) */
1722 
1723 	byte win;   	/* Destination "window" */
1724 	s16b row;   	/* Position there */
1725 	s16b col;
1726 
1727 	u32b flag;  	/* Indicator flags */
1728 	cptr prompt;	/* Hack -- display what additional info..? */
1729 	u64b redraw;	/* "Redraw" flag (same as p_ptr->redraw, PR_ flags) */
1730 	cptr mark;  	/* Hack -- name */
1731 };
1732 
1733 struct item_tester_type
1734 {
1735 	byte tval[MAX_ITH_TVAL];	/* Array of matching TVALs */
1736 	byte flag;              	/* Pre-calculated flag */
1737 };
1738