1 /* $Id$ */
2 /* File: types.h */
3 
4 /* Purpose: global type declarations */
5 
6 /*
7  * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8  *
9  * This software may be copied and distributed for educational, research, and
10  * not for profit purposes provided that this copyright and statement are
11  * included in all such copies.
12  */
13 
14 
15 /*
16  * This file should ONLY be included by "angband.h"
17  */
18 
19 
20 /*
21  * Note that "char" may or may not be signed, and that "signed char"
22  * may or may not work on all machines.  So always use "s16b" or "s32b"
23  * for signed values.  Also, note that unsigned values cause math problems
24  * in many cases, so try to only use "u16b" and "u32b" for "bit flags",
25  * unless you really need the extra bit of information, or you really
26  * need to restrict yourself to a single byte for storage reasons.
27  *
28  * Also, if possible, attempt to restrict yourself to sub-fields of
29  * known size (use "s16b" or "s32b" instead of "int", and "byte" instead
30  * of "bool"), and attempt to align all fields along four-byte words, to
31  * optimize storage issues on 32-bit machines.  Also, avoid "bit flags"
32  * since these increase the code size and slow down execution.  When
33  * you need to store bit flags, use one byte per flag, or, where space
34  * is an issue, use a "byte" or "u16b" or "u32b", and add special code
35  * to access the various bit flags.
36  *
37  * Many of these structures were developed to reduce the number of global
38  * variables, facilitate structured program design, allow the use of ascii
39  * template files, simplify access to indexed data, or facilitate efficient
40  * clearing of many variables at once.
41  *
42  * Certain data is saved in multiple places for efficient access, currently,
43  * this includes the tval/sval/weight fields in "object_type", various fields
44  * in "header_type", and the "m_idx" and "o_idx" fields in "cave_type".  All
45  * of these could be removed, but this would, in general, slow down the game
46  * and increase the complexity of the code.
47  */
48 
49 
50 
51 
52 
53 /*
54  * Template file header information (see "init.c").  16 bytes.
55  *
56  * Note that the sizes of many of the "arrays" are between 32768 and
57  * 65535, and so we must use "unsigned" values to hold the "sizes" of
58  * these arrays below.  Normally, I try to avoid using unsigned values,
59  * since they can cause all sorts of bizarre problems, but I have no
60  * choice here, at least, until the "race" array is split into "normal"
61  * and "unique" monsters, which may or may not actually help.
62  *
63  * Note that, on some machines, for example, the Macintosh, the standard
64  * "read()" and "write()" functions cannot handle more than 32767 bytes
65  * at one time, so we need replacement functions, see "util.c" for details.
66  *
67  * Note that, on some machines, for example, the Macintosh, the standard
68  * "malloc()" function cannot handle more than 32767 bytes at one time,
69  * but we may assume that the "ralloc()" function can handle up to 65535
70  * butes at one time.  We should not, however, assume that the "ralloc()"
71  * function can handle more than 65536 bytes at a time, since this might
72  * result in segmentation problems on certain older machines, and in fact,
73  * we should not assume that it can handle exactly 65536 bytes at a time,
74  * since the internal functions may use an unsigned short to specify size.
75  *
76  * In general, these problems occur only on machines (such as most personal
77  * computers) which use 2 byte "int" values, and which use "int" for the
78  * arguments to the relevent functions.
79  */
80 
81 typedef struct header header;
82 
83 struct header
84 {
85 	byte	v_major;		/* Version -- major */
86 	byte	v_minor;		/* Version -- minor */
87 	byte	v_patch;		/* Version -- patch */
88 	byte	v_extra;		/* Version -- extra */
89 
90 
91 	u32b	info_num;		/* Number of "info" records */
92 
93 	u32b	info_len;		/* Size of each "info" record */
94 
95 
96 	u32b	head_size;		/* Size of the "header" in bytes */
97 
98 	u32b	info_size;		/* Size of the "info" array in bytes */
99 
100 	u32b	name_size;		/* Size of the "name" array in bytes */
101 
102 	u32b	text_size;		/* Size of the "text" array in bytes */
103 };
104 
105 
106 /* worldpos - replaces depth/dun_depth ulong with x,y,z
107  * coordinates of world positioning.
108  * it may seem cumbersome, but better than having
109  * extra variables in each struct. (its standard).
110  */
111 typedef struct worldpos worldpos;
112 
113 struct worldpos
114 {
115 	s16b wx;	/* west to east */
116 	s16b wy;	/* south to north */
117 	s16b wz;	/* deep to sky */
118 };
119 
120 /* worldspot adds exact x and y coordinates */
121 typedef struct worldspot worldspot;
122 
123 struct worldspot
124 {
125 	struct worldpos wpos;
126 	s16b x;
127 	s16b y;
128 };
129 
130 /* cavespot consists of coordinates within a cave */
131 typedef struct cavespot cavespot;
132 
133 struct cavespot
134 {
135 	s16b x;
136 	s16b y;
137 };
138 
139 
140 /*
141  * "Themed" objects.
142  * Probability in percent for each class of objects to be dropped.
143  * This could perhaps be an array - but that wouldn't be as clear.
144  */
145 /* Borrowed from ToME	- Jir - */
146 typedef struct obj_theme obj_theme;
147 struct obj_theme
148 {
149 	byte treasure;
150 	byte combat;
151 	byte magic;
152 	byte tools;
153 };
154 
155 
156 /*
157  * Information about terrain "features"
158  */
159 
160 typedef struct feature_type feature_type;
161 
162 struct feature_type
163 {
164 	u16b name;			/* Name (offset) */
165 	u16b text;			/* Text (offset) */
166 #if 1
167 	u32b tunnel;            /* Text for tunneling */
168 	u32b block;             /* Text for blocking */
169 
170 	u32b flags1;            /* First set of flags */
171 	u32b flags2;
172 #endif
173 
174 	byte mimic;			/* Feature to mimic */
175 
176 	byte extra;			/* Extra byte (unused) */
177 
178 	s16b unused;		/* Extra bytes (unused) */
179 
180 	/* NOTE: it's d_ and x_ in ToME */
181 	byte f_attr;		/* Object "attribute" */
182 	char f_char;		/* Object "symbol" */
183 
184 	byte z_attr;		/* The desired attr for this feature */
185 	char z_char;		/* The desired char for this feature */
186 
187 #if 1
188 	byte shimmer[7];        /* Shimmer colors */
189 
190 	int d_dice[4];                  /* Number of dices */
191 	int d_side[4];                  /* Number of sides */
192 	int d_frequency[4];             /* Frequency of damage (1 is the minimum) */
193 	int d_type[4];                  /* Type of damage */
194 #endif
195 };
196 
197 
198 /*
199  * Information about object "kinds", including player knowledge.
200  *
201  * Only "aware" and "tried" are saved in the savefile
202  */
203 
204 typedef struct object_kind object_kind;
205 
206 struct object_kind
207 {
208 	u16b name;			/* Name (offset) */
209 	u16b text;			/* Text (offset) */
210 
211 	byte tval;			/* Object type */
212 	byte sval;			/* Object sub type */
213 
214 	s16b pval;			/* Object extra info */
215 
216 	s16b to_h;			/* Bonus to hit */
217 	s16b to_d;			/* Bonus to damage */
218 	s16b to_a;			/* Bonus to armor */
219 
220 	s16b ac;			/* Base armor */
221 
222 	byte dd, ds;		/* Damage dice/sides */
223 
224 	s16b weight;		/* Weight */
225 
226 	s32b cost;			/* Object "base cost" */
227 
228 	u32b flags1;		/* Flags, set 1 */
229 	u32b flags2;		/* Flags, set 2 */
230 	u32b flags3;		/* Flags, set 3 */
231         u32b flags4;            /* Flags, set 4 */
232         u32b flags5;            /* Flags, set 5 */
233         u32b flags6;            /* Flags, set 6 */
234 
235 
236 	byte locale[4];		/* Allocation level(s) */
237 	byte chance[4];		/* Allocation chance(s) */
238 
239 	byte level;			/* Level */
240 	byte extra;			/* Something */
241 
242 
243 	byte k_attr;		/* Standard object attribute */
244 	char k_char;		/* Standard object character */
245 
246 
247 	byte d_attr;		/* Default object attribute */
248 	char d_char;		/* Default object character */
249 
250 
251 	byte x_attr;		/* Desired object attribute */
252 	char x_char;		/* Desired object character */
253 
254 
255 	bool has_flavor;	/* This object has a flavor */
256 
257 	bool easy_know;		/* This object is always known (if aware) */
258 
259 
260 /*	bool aware;	*/		/* The player is "aware" of the item's effects */
261 
262 /*	bool tried;	*/		/* The player has "tried" one of the items */
263 
264         u32b esp;                       /* ESP flags */
265 #if 0
266         byte btval;                     /* Become Object type */
267         byte bsval;                     /* Become Object sub type */
268 
269         s16b power;                     /* Power granted(if any) */
270 #endif
271 };
272 
273 
274 
275 /*
276  * Information about "artifacts".
277  *
278  * Note that the save-file only writes "cur_num" to the savefile.
279  *
280  * Note that "max_num" is always "1" (if that artifact "exists")
281  */
282 
283 typedef struct artifact_type artifact_type;
284 
285 struct artifact_type
286 {
287 	u16b name;		/* Name (offset) */
288 	u16b text;		/* Text (offset) */
289 
290 	byte tval;		/* Artifact type */
291 	byte sval;		/* Artifact sub type */
292 
293 	s16b pval;		/* Artifact extra info */
294 
295 	s16b to_h;		/* Bonus to hit */
296 	s16b to_d;		/* Bonus to damage */
297 	s16b to_a;		/* Bonus to armor */
298 
299 	s16b ac;		/* Base armor */
300 
301 	byte dd, ds;		/* Damage when hits */
302 
303 	s16b weight;		/* Weight */
304 
305 	s32b cost;		/* Artifact "cost" */
306 
307 	u32b flags1;		/* Artifact Flags, set 1 */
308 	u32b flags2;		/* Artifact Flags, set 2 */
309 	u32b flags3;		/* Artifact Flags, set 3 */
310         u32b flags4;            /* Artifact Flags, set 4 */
311         u32b flags5;            /* Artifact Flags, set 5 */
312         u32b flags6;            /* Artifact Flags, set 6 */
313 
314 	byte level;		/* Artifact level */
315 	byte rarity;		/* Artifact rarity */
316 
317 	byte cur_num;		/* Number created (0 or 1) */
318 	byte max_num;		/* Unused (should be "1") */
319         u32b esp;               /* ESP flags */
320 #if 0
321 
322         s16b power;             /* Power granted(if any) */
323 
324         s16b set;               /* Does it belongs to a set ?*/
325 #endif	/* 0 */
326 
327 	bool known;		/* Is this artifact already IDed? */
328 
329 	s32b carrier;		/* Current holder (not necessarily same as o_ptr->owner), just to keep track */
330 	s32b timeout;		/* anti-hoarding artifact reset timer (-1 = permanent) */
331 	bool iddc;		/* for IDDC_ARTIFACT_FAST_TIMEOUT */
332 	bool winner;		/* for WINNER_ARTIFACT_FAST_TIMEOUT */
333 };
334 
335 
336 /*
337  * Information about "ego-items".
338  */
339 
340 typedef struct ego_item_type ego_item_type;
341 
342 struct ego_item_type
343 {
344 	u16b name;			/* Name (offset) */
345 	u16b text;			/* Text (offset) */
346 
347         bool before;                    /* Before or after the object name ? */
348 
349         byte tval[MAX_EGO_BASETYPES];
350         byte min_sval[MAX_EGO_BASETYPES];
351         byte max_sval[MAX_EGO_BASETYPES];
352 
353 	byte rating;		/* Rating boost */
354 
355 	byte level;			/* Minimum level */
356 	byte rarity;		/* Object rarity */
357         byte mrarity;           /* Object rarity */
358 
359 	char max_to_h;		/* Maximum to-hit bonus */
360 	char max_to_d;		/* Maximum to-dam bonus */
361 	char max_to_a;		/* Maximum to-ac bonus */
362 
363 	char max_pval;		/* Maximum pval */
364 
365 	s32b cost;			/* Ego-item "cost" */
366 
367         byte rar[5];
368         u32b flags1[5];            /* Ego-Item Flags, set 1 */
369         u32b flags2[5];            /* Ego-Item Flags, set 2 */
370         u32b flags3[5];            /* Ego-Item Flags, set 3 */
371         u32b flags4[5];            /* Ego-Item Flags, set 4 */
372         u32b flags5[5];            /* Ego-Item Flags, set 5 */
373         u32b flags6[5];            /* Ego-Item Flags, set 6 */
374         u32b esp[5];                       /* ESP flags */
375         u32b fego1[5];                       /* ego flags */
376         u32b fego2[5];                       /* ego flags */
377 
378 #if 0
379         s16b power;                     /* Power granted(if any) */
380 #endif
381 };
382 
383 
384 
385 
386 /*
387  * Monster blow structure
388  *
389  *	- Method (RBM_*)
390  *	- Effect (RBE_*)
391  *	- Damage Dice
392  *	- Damage Sides
393  */
394 
395 typedef struct monster_blow monster_blow;
396 
397 struct monster_blow
398 {
399 	byte method;
400 	byte effect;
401 	byte d_dice;
402 	byte d_side;
403 	byte org_d_dice;
404 	byte org_d_side;
405 };
406 
407 
408 
409 /*
410  * Monster "race" information, including racial memories
411  *
412  * Note that "d_attr" and "d_char" are used for MORE than "visual" stuff.
413  *
414  * Note that "x_attr" and "x_char" are used ONLY for "visual" stuff.
415  *
416  * Note that "cur_num" (and "max_num") represent the number of monsters
417  * of the given race currently on (and allowed on) the current level.
418  * This information yields the "dead" flag for Unique monsters.
419  *
420  * Note that "max_num" is reset when a new player is created.
421  * Note that "cur_num" is reset when a new level is created.
422  *
423  * Note that several of these fields, related to "recall", can be
424  * scrapped if space becomes an issue, resulting in less "complete"
425  * monster recall (no knowledge of spells, etc).  All of the "recall"
426  * fields have a special prefix to aid in searching for them.
427  */
428 
429 
430 typedef struct monster_race monster_race;
431 
432 struct monster_race
433 {
434 	u16b name;				/* Name (offset) */
435 	u16b text;				/* Text (offset) */
436 	u16b dup_idx;				/* For mimicry: Race idx of duplicate that differs only in FRIENDS flag */
437 
438 	u16b hdice;				/* Creatures hit dice count */
439 	u16b hside;				/* Creatures hit dice sides */
440 
441 	s16b ac;				/* Armour Class */
442 
443 	s16b sleep;				/* Inactive counter (base) */
444 	byte aaf;				/* Area affect radius (1-100) */
445 	byte speed;				/* Speed (normally 110) */
446 
447 	s32b mexp;				/* Exp value for kill */
448 
449 	s32b weight;		/* Weight of the monster */
450 	s16b extra;				/* Unused (for now) */
451 
452 	byte freq_innate;		/* Innate spell frequency */
453 	byte freq_spell;		/* Other spell frequency */
454 
455 	u32b flags1;			/* Flags 1 (general) */
456 	u32b flags2;			/* Flags 2 (abilities) */
457 	u32b flags3;			/* Flags 3 (race/resist) */
458 	u32b flags4;			/* Flags 4 (innate/breath) */
459 	u32b flags5;			/* Flags 5 (normal spells) */
460 	u32b flags6;			/* Flags 6 (special spells) */
461 #if 1
462 	u32b flags7;			/* Flags 7 (movement related abilities) */
463 	u32b flags8;			/* Flags 8 (wilderness info) */
464 	u32b flags9;			/* Flags 9 (drops info) */
465 
466 	u32b flags0;			/* Flags 10 (extra spells) */
467 #endif
468 
469 	monster_blow blow[4];	/* Up to four blows per round */
470 
471 	byte body_parts[BODY_MAX];	/* To help to decide what to use when body changing */
472 
473 	s16b level;			/* Level of creature */
474 	byte rarity;			/* Rarity of creature */
475 
476 
477 	byte d_attr;			/* Default monster attribute */
478 	char d_char;			/* Default monster character */
479 
480 
481 	byte x_attr;			/* Desired monster attribute */
482 	char x_char;			/* Desired monster character */
483 
484 
485 	s32b max_num;			/* Maximum population allowed per level */
486 
487 	s32b cur_num;			/* Monster population on current level */
488 
489 	s32b r_sights;			/* Count sightings of this monster */
490 	s32b r_deaths;			/* Count deaths from this monster */
491 	s32b r_tkills;			/* Count monsters killed by all players */
492 
493 #ifdef OLD_MONSTER_LORE
494 	s16b r_pkills;			/* Count monsters killed in this life */
495 
496 	byte r_wake;			/* Number of times woken up (?) */
497 	byte r_ignore;			/* Number of times ignored (?) */
498 
499 	/*byte r_xtra1;			changed to time for japanese patch APD Something (unused)
500 	  byte r_xtra2;                    Something (unused) */
501 
502 	byte r_drop_gold;		/* Max number of gold dropped at once */
503 	byte r_drop_item;		/* Max number of item dropped at once */
504 
505 	byte r_cast_innate;		/* Max number of innate spells seen */
506 	byte r_cast_spell;		/* Max number of other spells seen */
507 
508 	byte r_blows[4];		/* Number of times each blow type was seen */
509 
510 	u32b r_flags1;			/* Observed racial flags */
511 	u32b r_flags2;			/* Observed racial flags */
512 	u32b r_flags3;			/* Observed racial flags */
513 	u32b r_flags4;			/* Observed racial flags */
514 	u32b r_flags5;			/* Observed racial flags */
515 	u32b r_flags6;			/* Observed racial flags */
516 #if 0
517 	u32b r_flags7;			/* Observed racial flags */
518 	u32b r_flags8;			/* Observed racial flags */
519 	u32b r_flags9;			/* Observed racial flags */
520 
521 	u32b r_flags0;			/* Observed racial flags */
522 #endif
523 #endif
524 
525 	obj_theme drops;		/* The drops type */
526 
527 	int u_idx;			/* Counter for sorted unique positioning */
528 
529 	int restrict_dun;		/* restrict to specific dungeon (used for non-FINAL_GUARDIAN monsters) */
530 };
531 
532 
533 
534 /*
535  * Information about "vault generation"
536  */
537 
538 typedef struct vault_type vault_type;
539 
540 struct vault_type
541 {
542 	u16b name;			/* Name (offset) */
543 	u32b text;			/* Text (offset) */
544 
545 	byte typ;			/* Vault type */
546 
547 	byte rat;			/* Vault rating */
548 
549 	byte hgt;			/* Vault height */
550 	byte wid;			/* Vault width */
551 
552 	u32b flags1;			/* VF1 flags */
553 
554 #if 0
555 	s16b lvl;                       /* level of special (if any) */
556 	byte dun_type;                  /* Dungeon type where the level will show up */
557 
558 	s16b mon[10];                   /* special monster */
559 	int item[3];                   /* number of item (usually artifact) */
560 #endif	/* 0 */
561 };
562 
563 typedef struct swear_info {
564 	char word[NAME_LEN];
565 	int level;
566 } swear_info;
567 
568 /* jk */
569 /* name and description are in some other arrays */
570 typedef struct trap_kind trap_kind;
571 struct trap_kind{
572   s16b probability; /* probability of existence */
573   s16b another;     /* does this trap easily combine */
574   s16b p1valinc;     /* how much does this trap attribute to p1val */
575   byte difficulty;  /* how difficult to disarm */
576   byte minlevel;    /* what is the minimum level on which the traps should be */
577   byte color;       /* what is the color on screen */
578   byte vanish;       /* probability of disappearence */
579   u32b flags;       /* where can these traps go - and perhaps other flags */
580 #if 0	/* Handled in player_type */
581   bool ident;       /* do we know the name */
582   s16b known;       /* how well is this trap known */
583 #endif
584   s16b name;        /* normal name like weakness */
585   s16b dd, ds;      /* base damage */
586   s16b text;        /* longer description once you've met this trap */
587 };
588 
589 
590 
591 /*
592  * A single "grid" in a Cave
593  *
594  * Note that several aspects of the code restrict the actual cave
595  * to a max size of 256 by 256.  In partcular, locations are often
596  * saved as bytes, limiting each coordinate to the 0-255 range.
597  *
598  * The "o_idx" and "m_idx" fields are very interesting.  There are
599  * many places in the code where we need quick access to the actual
600  * monster or object(s) in a given cave grid.  The easiest way to
601  * do this is to simply keep the index of the monster and object
602  * (if any) with the grid, but takes a lot of memory.  Several other
603  * methods come to mind, but they all seem rather complicated.
604  *
605  * Note the special fields for the simple "monster flow" code,
606  * and for the "tracking" code.
607  */
608 typedef struct c_special c_special;
609 
610 struct c_special{
611 	unsigned char type;
612 	union	/* 32bits -> 64bits (rune) */
613 	{
614 		void *ptr;		/* lazy - refer to other arrays or sth */
615 		s32b omni;		/* needless of other arrays? k, add here! */
616 		struct { byte t_idx; bool found; } trap;
617 		struct { byte fy, fx; } between; /* or simply 'dpos'? */
618 		struct { byte wx, wy; s16b wz; } wpos;	/* XXX */
619 		struct { byte type, rest; bool known; } fountain;
620 		struct { u16b trap_kit; byte difficulty, feat; } montrap;
621 		struct { byte typ, mod, lev, feat; s32b id; s16b note; byte discount; s16b level; } rune; /* CS_RUNE */
622 	} sc;
623 	struct c_special *next;
624 };
625 
626 typedef struct cave_type cave_type;
627 
628 /* hooks structure containing calls for specials */
629 struct sfunc{
630 	void (*load)(c_special *cs_ptr);		/* load function */
631 	void (*save)(c_special *cs_ptr);		/* save function */
632 	void (*see)(c_special *cs_ptr, char *c, byte *a, int Ind);	/* sets player view */
633 	int (*activate)(c_special *cs_ptr, int y, int x, int Ind);	/* walk on/bump */
634 };
635 
636 struct cave_type
637 {
638 	u32b info;		/* Hack -- cave flags */
639 	byte feat;		/* Hack -- feature type */
640 	byte feat_org;		/* Feature type backup (todo: for wall-created grids to revert to original feat when tunneled!) */
641 	s16b o_idx;		/* Item index (in o_list) or zero */
642 	s16b m_idx;		/* Monster index (in m_list) or zero */
643 				/* or negative if a player */
644 
645 #ifdef MONSTER_FLOW		/* Note: Currently only flow_by_sound is implemented, not flow_by_smell - C. Blue */
646 	byte cost;		/* Hack -- cost of flowing */
647 	byte when;		/* Hack -- when cost was computed */
648 #endif
649 #ifdef MONSTER_FLOW_BY_SMELL	/* Added this for reduced stamp radius around the player, representing his "scent" surrounding him - C. Blue */
650 	byte cost_smell;	/* Hack -- cost of flowing */
651 	byte when_smell;	/* Hack -- when cost was computed */
652 #endif
653 
654 #if 0 /* since monsters might track different players, with paths leading over same grids though, I'm adding this to astar_list instead - C. Blue */
655 #ifdef MONSTER_ASTAR
656 	int astarF, astarG, astarH; /* grid score (F=G+H), starting point distance cost, estimated goal distance cost */
657 #endif
658 #endif
659 
660 	struct c_special *special;	/* Special pointer to various struct */
661 
662 	/* I don't really love to enlarge cave_type ... but it'd suck if
663 	 * trapped floor will be immune to Noxious Cloud */
664 	/* Adding 1byte in this struct costs 520Kb memory, in average */
665 	/* This should be replaced by 'stackable c_special' code -
666 	 * let's wait for evileye to to this :)		- Jir - */
667 	int effect, effect_xtra;	/* The lasting effects */
668 
669 #ifdef HOUSE_PAINTING
670 	byte colour;	/* colour that overrides the usual colour of a feature */
671 #endif
672 };
673 
674 /* ToME parts, arranged */
675 /* This struct can be enlarged to handle more generic timed events maybe? */
676 /* Lasting spell effects(clouds, ..) */
677 typedef struct effect_type effect_type;
678 struct effect_type
679 {
680 	s16b	interval;	/* How quickly does it tick (10 = normal, once per 10 frames at 0 ft depth) */
681 	s16b    time;           /* For how long */
682 	s16b    dam;            /* How much damage */
683 	u32b    type;           /* Of which type */ /* GF_XXX, for now */
684 	s16b	sy;		/* Start of the cast (beam shapes) */
685 	s16b	sx;		/* Start of the cast (beam shapes) */
686 	s16b    cy;             /* Center of the cast */
687 	s16b    cx;             /* Center of the cast */
688 	s16b    rad;            /* Radius */
689 	u32b    flags;          /* Flags */
690 
691 	s32b	who;		/* Who caused this effect (0-id if player) */
692 	worldpos wpos;		/* Where in the world */
693 };
694 
695 /*
696  * Structure for an object. (32 bytes)
697  *
698  * Note that a "discount" on an item is permanent and never goes away.
699  *
700  * Note that inscriptions are now handled via the "quark_str()" function
701  * applied to the "note" field, which will return NULL if "note" is zero.
702  *
703  * Note that "object" records are "copied" on a fairly regular basis.
704  *
705  * Note that "object flags" must now be derived from the object kind,
706  * the artifact and ego-item indexes, and the two "xtra" fields.
707  */
708 
709 typedef struct object_type object_type;
710 
711 struct object_type {
712         s32b owner;                     /* Player that found it */
713         byte mode;                	/* Mode of player who found it */
714         s16b level;                     /* Level req */
715 			/* Hack -- ego-items use 'level' in a special way, and
716 			 * altering this value will result in change of ego-item
717 			 * powers themselves!	- Jir -
718 			 */
719 
720 	s16b k_idx;			/* Kind index (zero if "dead") */
721 
722 	byte iy;			/* Y-position on map, or zero */
723 	byte ix;			/* X-position on map, or zero */
724 
725 	struct worldpos wpos;
726 
727 	byte tval;			/* Item type (from kind) */
728 	byte sval;			/* Item sub-type (from kind) */
729 	byte tval2;			/* normally unused (except for item-invalid-seal) */
730 	byte sval2;			/* normally unused (except for item-invalid-seal) */
731 
732 	s32b bpval;			/* Base item extra-parameter */
733 	s32b pval;			/* Extra enchantment item extra-parameter (name1 or name2) */
734 #if 1 /* existing but currently not in use */
735 	s32b pval2;			/* Item extra-parameter for some special items */
736 	s32b pval3;			/* Item extra-parameter for some special items */
737 #endif
738 
739 	/* Used for temporarily augmented equipment. (Runecraft) */
740 	s32b sigil;			/* Element index (+1) for r_projection (common/tables.c) boni lookup. Zero if no sigil. */
741 	s32b sseed;			/* RNG Seed used to determine the boni (if random). Zero if not randomized. */
742 
743 	byte discount;		/* Discount (if any) */
744 
745 	byte number;		/* Number of items */
746 
747 	s16b weight;		/* Item weight */
748 
749 	u16b name1;			/* Artifact type, if any */
750 	u16b name2;			/* Ego-Item type, if any */
751 	u16b name2b;			/* 2e Ego-Item type, if any */
752 	s32b name3;			/* Randart seed, if any (now it's common with ego-items -Jir-) */
753 	u16b name4;			/* Index of randart name in file 'randarts.txt', solely for fun set bonus - C. Blue */
754 	byte attr;			/* colour in inventory (for client) */
755 
756 	byte xtra1;			/* Extra info type, for various purpose */
757 	byte xtra2;			/* Extra info index */
758 	/* more info added for self-made spellbook feature Adam suggested - C. Blue */
759 	byte xtra3;			/* Extra info */
760 	byte xtra4;			/* Extra info */
761 	byte xtra5;			/* Extra info */
762 	byte xtra6;			/* Extra info */
763 	byte xtra7;			/* Extra info */
764 	byte xtra8;			/* Extra info */
765 	byte xtra9;			/* Extra info */
766 
767 #ifdef PLAYER_STORES
768 	byte ps_idx_x;			/* Index or x-coordinate of player store item in the original house */
769 	byte ps_idx_y;			/* y-coordinate of player store item in the original house */
770 #endif
771 
772 	s16b to_h;			/* Plusses to hit */
773 	s16b to_d;			/* Plusses to damage */
774 	s16b to_a;			/* Plusses to AC */
775 
776 	s16b ac;			/* Normal AC */
777 
778 	byte dd, ds;			/* Damage dice/sides */
779 
780 	s32b timeout;			/* Timeout Counter */
781 
782 	u16b ident;			/* Special flags  */
783 
784 	s32b marked;			/* Object is marked (for deletion after a certain time) */
785 	byte marked2;			/* additional parameters */
786 	/* for new quest_info: */
787 	bool questor;			/* further quest_info flags are referred to when required, no need to copy all of them here */
788 	byte questor_invincible;	/* invincible to players/monsters? */
789 	s16b quest, quest_stage, questor_idx;	/* It's an item for a quest (either the questor item or an item that needs to be retrieved for a quest goal).
790 		//IMPORTAAAAAAANT:	   Hack: 0 = no quest; n = quest + 1. So we don't have to initialise all items to -1 here :-p */
791 	bool quest_credited;		/* ugly hack for inven_carry() usage within carry(), to avoid double-crediting */
792 
793 	u16b note;			/* Inscription index */
794 	char note_utag;			/* Added for making pseudo-id overwrite unique loot tags */
795 
796 	char uses_dir;			/* Client-side: Uses a direction or not? (for rods) */
797 
798 #if 0	/* from pernA.. consumes memory, but quick. shall we? */
799         u16b art_name;			/* Artifact name (random artifacts) */
800 
801         u32b art_flags1;        	/* Flags, set 1  Alas, these were necessary */
802         u32b art_flags2;        	/* Flags, set 2  for the random artifacts of*/
803         u32b art_flags3;        	/* Flags, set 3  Zangband */
804         u32b art_flags4;        	/* Flags, set 4  PernAngband */
805         u32b art_flags5;        	/* Flags, set 5  PernAngband */
806         u32b art_esp;           	/* Flags, set esp  PernAngband */
807 #endif	/* 0 */
808 
809 	byte inven_order;		/* Inventory position if held by a player,
810 					   only use is in xtra2.c when pack is ang_sort'ed */
811 	bool auto_insc;			/* Request client-side auto-inscription after item has changed? */
812 
813 	u16b next_o_idx;		/* Next object in stack (if any) */
814 	u16b held_m_idx;		/* Monster holding us (if any) */
815 	char stack_pos;			/* Position in stack: Use to limit stack size */
816 
817 	s16b cheeze_dlv, cheeze_plv, cheeze_plv_carry;	/* anti-cheeze */
818 
819 	bool changed;		/* dummy flag to refresh item if o_name changed, but memory copy didn't */
820 
821 	bool NR_tradable;		/* for ALLOW_NR_CROSS_ITEMS */
822 };
823 
824 /*
825  * NPC type information - LUA programmable
826  * Basic structure for experimental use only
827  * More data will need to be added for the
828  * real thing.
829  */
830 
831 struct npc_type{
832 	byte active;			/* ignore this? */
833 	char name[20];			/* NPC name */
834 	s16b fy, fx;			/* Position */
835 	struct worldpos wpos;
836 
837         s32b exp;                       /* Experience of the monster */
838         s16b level;                     /* Level of the monster */
839 
840 	s16b energy;		/* Monster "energy" */
841 
842 	byte stunned;		/* Monster is stunned */
843 	byte confused;		/* Monster is confused */
844 	byte monfear;		/* Monster is afraid */
845 };
846 
847 /*
848  * Monster information, for a specific monster.
849  *
850  * Note: fy, fx constrain dungeon size to 256x256
851  */
852 
853 typedef struct monster_type monster_type;
854 
855 struct monster_type {
856    byte pet;			/* Special pet value (not an ID). 0 = not a pet. 1 = is a pet. */
857    bool special;                   /* Does it use a special r_info ? */
858    monster_race *r_ptr;            /* The aforementionned r_info */
859 
860    s32b owner;                     /* id of Player owning it */
861 
862    s16b r_idx;			/* Monster race index */
863 
864    byte fy;			/* Y location on map */
865    byte fx;			/* X location on map */
866 
867    struct worldpos wpos;
868 
869    s32b exp;                       /* Experience of the monster */
870    s16b level;                     /* Level of the monster */
871 
872    monster_blow blow[4];        /* Up to four blows per round */
873    byte speed;			/* ORIGINAL Monster "speed" (gets copied from r_ptr->speed on monster placement) */
874    byte mspeed;			/* CURRENT Monster "speed" (is set to 'speed' initially on monster placement) */
875    s16b ac;                     /* Armour Class */
876    s16b org_ac;               	/* Armour Class */
877 
878    s32b hp;                        /* Current Hit points */
879    s32b maxhp;                     /* Max Hit points */
880    s32b org_maxhp;                 /* Max Hit points */
881 
882    s16b csleep;		/* Inactive counter */
883 
884    s16b energy;		/* Monster "energy" */
885 
886    byte monfear;		/* Monster is afraid */
887    byte monfear_gone;		/* Monster is no longer afraid because it has no other options or is temporarily immune */
888    byte confused;		/* Monster is confused */
889    byte stunned;		/* Monster is stunned */
890    byte paralyzed;		/* Monster is paralyzed (unused) */
891    byte bleeding;		/* Monster is bleeding (unused) */
892    byte poisoned;		/* Monster is poisoned (unused) */
893    byte blinded;		/* monster appears confused (unused: wrapped as confusion currently) */
894    byte silenced;		/* monster can't cast spells for a short time (for new mindcrafters) */
895    int charmedignore;		/* monster is charmed in a way that it ignores players */
896 
897    u16b hold_o_idx;	/* Object being held (if any) */
898 
899    s16b cdis;			/* Current dis from player */
900 
901    /*	bool los;*/			/* Monster is "in sight" */
902    /*	bool ml;*/			/* Monster is "visible" */
903 
904    s16b closest_player;	/* The player closest to this monster */
905 
906    #ifdef WDT_TRACK_OPTIONS
907 
908    byte ty;			/* Y location of target */
909    byte tx;			/* X location of target */
910    byte t_dur;			/* How long are we tracking */
911    byte t_bit;			/* Up to eight bit flags */
912 
913    #endif
914 
915    #ifdef DRS_SMART_OPTIONS
916 
917    u32b smart;			/* Field for "smart_learn" */
918 
919    #endif
920 
921    u16b clone;			/* clone value */
922    u16b clone_summoning;		/* counter to keep track of summoning */
923 
924    s16b mind;                      /* Current action -- golems */
925 
926    #ifdef RANDUNIS
927    u16b ego;                       /* Ego monster type */
928    s32b name3;			/* Randuni seed, if any */
929    #endif
930 
931    s16b status;			/* Status(friendly, pet, companion, ..) */
932    s16b target;			/* Monster target */
933    s16b possessor;		/* Is it under the control of a possessor ? */
934    s16b destx, desty;		/* Monster target grid to walk to. Added for questors (quest_info). */
935    s16b determination;		/* unused, maybe useful in the future for determining what it takes to stop the monster from doing something */
936    s16b limit_hp;		/* for questors - revert hostility when <= this (makes lookup easier than referring through lots of pointers..) */
937 
938    u16b ai_state;		/* What special behaviour this monster takes now? */
939    s16b last_target;		/* For C. Blue's anti-cheeze C_BLUE_AI in melee2.c */
940    s16b last_target_melee;	/* For C. Blue's C_BLUE_AI_MELEE in melee2.c */
941    s16b last_target_melee_temp;	/* For C. Blue's C_BLUE_AI_MELEE in melee2.c */
942    s16b switch_target;		/* For distract_monsters(), implemented within C_BLUE_AI_MELEE in melee2.c */
943 
944    s16b cdis_on_damage;		/* New Ball spell / explosion anti-cheeze */
945 //   byte turns_tolerance;	/* Optional: How many turns pass until we react the new way */
946    s16b damage_tx, damage_ty;	/* new temporary target position: where we received damage from */
947    signed char previous_direction;	/* Optional: Don't move right back where we came from (at least during this turn -_-) after reaching the damage epicentrum. */
948    s16b damage_dis;		/* Remember distance to epicenter */
949    s16b p_tx, p_ty;		/* Coordinates from where the player cast the damaging projection */
950 
951    s16b henc, henc_top;	/* 'highest_encounter' - my final anti-cheeze strike I hope ;) - C. Blue
952       This keeps track of the highest player which the monster
953       has 'encountered' (might offer various definitions of this
954       by different #defines) and adjusts its own experience value
955       towards that player, so low players who get powerful help
956       will get less exp out of it. */
957    byte backstabbed;		/* has this monster been backstabbed from cloaking mode already? prevent exploit */
958    byte taunted;		/* has this monster been taunted (melee technique)? */
959 
960    bool no_esp_phase;		/* for WEIRD_MIND esp flickering */
961    int extra;			/* extra flag for debugging/testing purpose; also used for target dummy's "snowiness" now; new: also for Sauron boosting */
962 
963 #ifdef MONSTER_ASTAR
964     int astar_idx;		/* index in available A* arrays. A* is expensive, so we only provide a couple of instances for a few monsters to use */
965 #endif
966 
967     u16b do_dist;		/* execute all monster teleportation at the end of turn */
968 
969 #if 0 /* currently solved by bidirectional LoS testing via DOUBLE_LOS_SAFETY instead! */
970     byte xlos_x[5], xlos_y[5];	/* Prevent system immanent LoS-exploit when monster gets targetted diagonally */
971     /* note: affects near_hit, process_monsters, make_attack_spell, summon_possible, clean_shot..., projectable..., los... */
972 #endif
973 
974     /* Prevent a monster getting hit by cumulative projections caused recursively in project()
975        (except for intended effects such as runecraft sub-explosions). */
976     int hit_proj_id;
977 
978     /* for new quest_info */
979     bool questor;
980     byte questor_invincible; /* further quest_info flags are referred to when required, no need to copy all of them here */
981     byte questor_hostile; /* hostility flags (0x1 = vs py, 0x2 = vs mon) */
982     byte questor_target; /* can get targetted by monsters and stuff..? */
983     s16b quest, questor_idx;
984 };
985 
986 typedef struct monster_ego monster_ego;
987 
988 struct monster_ego
989 {
990 	u32b name;				/* Name (offset) */
991 	bool before;                            /* Display ego before or after */
992 
993 	monster_blow blow[4];                   /* Up to four blows per round */
994 	byte blowm[4][2];
995 
996 	s16b hdice;                             /* Creatures hit dice count */
997 	s16b hside;                             /* Creatures hit dice sides */
998 
999 	s16b ac;				/* Armour Class */
1000 
1001 	s16b sleep;				/* Inactive counter (base) */
1002 	s16b aaf;                               /* Area affect radius (1-100) */
1003 	s16b speed;                             /* Speed (normally 110) */
1004 
1005 	s32b mexp;				/* Exp value for kill */
1006 
1007 	s32b weight;                            /* Weight of the monster */
1008 
1009 	byte freq_innate;               /* Innate spell frequency */
1010 	byte freq_spell;		/* Other spell frequency */
1011 
1012 	/* Ego flags */
1013 	u32b flags1;                    /* Flags 1 */
1014 	u32b flags2;                    /* Flags 1 */
1015 	u32b flags3;                    /* Flags 1 */
1016 	u32b flags7;                    /* Flags 1 */
1017 	u32b flags8;                    /* Flags 1 */
1018 	u32b flags9;                    /* Flags 1 */
1019 	u32b flags0;                    /* Flags 1 */
1020 	u32b hflags1;                    /* Flags 1 */
1021 	u32b hflags2;                    /* Flags 1 */
1022 	u32b hflags3;                    /* Flags 1 */
1023 	u32b hflags7;                    /* Flags 1 */
1024 	u32b hflags8;                    /* Flags 1 */
1025 	u32b hflags9;                    /* Flags 1 */
1026 	u32b hflags0;                    /* Flags 1 */
1027 
1028 	/* Monster flags */
1029 	u32b mflags1;                    /* Flags 1 (general) */
1030 	u32b mflags2;                    /* Flags 2 (abilities) */
1031 	u32b mflags3;                    /* Flags 3 (race/resist) */
1032 	u32b mflags4;                    /* Flags 4 (innate/breath) */
1033 	u32b mflags5;                    /* Flags 5 (normal spells) */
1034 	u32b mflags6;                    /* Flags 6 (special spells) */
1035 	u32b mflags7;                    /* Flags 7 (movement related abilities) */
1036 	u32b mflags8;                    /* Flags 8 (wilderness info) */
1037 	u32b mflags9;                    /* Flags 9 (drops info) */
1038 	u32b mflags0;                    /* Flags 10 (extra spells) */
1039 
1040 	/* Negative Flags, to be removed from the monster flags */
1041 	u32b nflags1;                    /* Flags 1 (general) */
1042 	u32b nflags2;                    /* Flags 2 (abilities) */
1043 	u32b nflags3;                    /* Flags 3 (race/resist) */
1044 	u32b nflags4;                    /* Flags 4 (innate/breath) */
1045 	u32b nflags5;                    /* Flags 5 (normal spells) */
1046 	u32b nflags6;                    /* Flags 6 (special spells) */
1047 	u32b nflags7;                    /* Flags 7 (movement related abilities) */
1048 	u32b nflags8;                    /* Flags 8 (wilderness info) */
1049 	u32b nflags9;                    /* Flags 9 (drops info) */
1050 	u32b nflags0;                    /* Flags 10 (extra spells) */
1051 
1052 	s16b level;                     /* Level of creature */
1053 	s16b rarity;                    /* Rarity of creature */
1054 
1055 
1056 	byte d_attr;			/* Default monster attribute */
1057 	char d_char;			/* Default monster character */
1058 
1059 	char r_char[10];                 /* Monster race allowed */
1060 	char nr_char[10];                /* Monster race not allowed */
1061 };
1062 
1063 
1064 
1065 
1066 /*
1067  * An entry for the object/monster allocation functions
1068  *
1069  * Pass 1 is determined from allocation information
1070  * Pass 2 is determined from allocation restriction
1071  * Pass 3 is determined from allocation calculation
1072  */
1073 
1074 typedef struct alloc_entry alloc_entry;
1075 
1076 struct alloc_entry
1077 {
1078 	s16b index;		/* The actual index */
1079 
1080 	s16b level;		/* Base dungeon level */
1081 	s16b prob1;		/* Probability, pass 1 */
1082 	s16b prob2;		/* Probability, pass 2 */
1083 	s16b prob3;		/* Probability, pass 3 */
1084 };
1085 
1086 
1087 /*
1088  * The setup data that the server transmits to the
1089  * client.
1090  */
1091 /*
1092  * Very sorry, this struct doesn't contain all the data sent during setup.
1093  * Please see Init_setup for details.		- Jir -
1094  */
1095 typedef struct setup_t setup_t;
1096 
1097 struct setup_t
1098 {
1099 	s16b frames_per_second;
1100 	byte max_race;
1101 	byte max_class;
1102 	byte max_trait;
1103 	int motd_len;
1104 	int setup_size;
1105 	/* char motd[80 * 23]; */
1106 	char motd[120 * 23];
1107 };
1108 
1109 /*
1110  * The setup data that the client transmits to the
1111  * server.
1112  */
1113 typedef struct client_setup_t client_setup_t;
1114 
1115 struct client_setup_t
1116 {
1117 	bool options[OPT_MAX];
1118 
1119 	s16b screen_wid;
1120 	s16b screen_hgt;
1121 
1122 	byte u_attr[TV_MAX];
1123 	char u_char[TV_MAX];
1124 
1125 	byte f_attr[MAX_F_IDX];
1126 	char f_char[MAX_F_IDX];
1127 
1128 	byte k_attr[MAX_K_IDX];
1129 	char k_char[MAX_K_IDX];
1130 
1131 	byte r_attr[MAX_R_IDX];
1132 	char r_char[MAX_R_IDX];
1133 };
1134 
1135 
1136 /*
1137  * Available "options"
1138  *
1139  *	- Address of actual option variable (or NULL)
1140  *
1141  *	- Normal Value (TRUE or FALSE)
1142  *
1143  *	- Option Page Number (or zero)
1144  *
1145  *	- Savefile Set (or zero)
1146  *	- Savefile Bit in that set
1147  *
1148  *	- Textual name (or NULL)
1149  *	- Textual description
1150  */
1151 
1152 typedef struct option_type option_type;
1153 
1154 struct option_type
1155 {
1156 	bool	*o_var;
1157 
1158 	byte	o_norm;
1159 
1160 	byte	o_page;
1161 
1162 	byte	o_set;
1163 	byte	o_bit;
1164 	byte	o_enabled;
1165 
1166 	cptr	o_text;
1167 	cptr	o_desc;
1168 };
1169 
1170 /*
1171  * A store, with an owner, various state flags, a current stock
1172  * of items, and a table of items that are often purchased.
1173  */
1174 typedef struct store_type store_type;
1175 
1176 struct store_type
1177 {
1178 	u16b st_idx;
1179 
1180 	u16b owner;                     /* Owner index */
1181 
1182 #ifdef PLAYER_STORES
1183 	u32b player_owner;		/* Temporary value for player's id */
1184 	byte player_owner_type;		/* Is it really a player or maybe a guild? */
1185 #endif
1186 
1187 	s16b insult_cur;		/* Insult counter */
1188 
1189 	s16b good_buy;			/* Number of "good" buys */
1190 	s16b bad_buy;			/* Number of "bad" buys */
1191 
1192 	s32b store_open;		/* Closed until this turn */
1193 
1194 	s32b last_visit;		/* Last visited on this turn */
1195 
1196 	byte stock_num;			/* Stock -- Number of entries */
1197 	s16b stock_size;		/* Stock -- Total Size of Array */
1198 	object_type *stock;		/* Stock -- Actual stock items */
1199 
1200 	s16b town;			/* residence town of this store. Just added for debugging purposes - C. Blue */
1201 
1202 	s16b tim_watch;			/* store owner watching out for thieves? */
1203 	s32b last_theft;		/* Turn of the last occurred theft that was noticed by the owner */
1204 };
1205 
1206 /*
1207  * Structure for the "quests"
1208  *
1209  * Hack -- currently, only the "level" parameter is set, with the
1210  * semantics that "one (QUEST) monster of that level" must be killed,
1211  * and then the "level" is reset to zero, meaning "all done".  Later,
1212  * we should allow quests like "kill 100 fire hounds", and note that
1213  * the "quest level" is then the level past which progress is forbidden
1214  * until the quest is complete.  Note that the "QUESTOR" flag then could
1215  * become a more general "never out of depth" flag for monsters.
1216  *
1217  * Actually, in Angband 2.8.0 it will probably prove easier to restrict
1218  * the concept of quest monsters to specific unique monsters, and to
1219  * actually scan the dead unique list to see what quests are left.
1220  */
1221 
1222 typedef struct xorder xorder; /* UNUSED. The new 'xorder_type' is used instead. */
1223 struct xorder {
1224 	int level;		/* Dungeon level */
1225 	int r_idx;		/* Monster race */
1226 
1227 	int cur_num;		/* Number killed (unused) */
1228 	int max_num;		/* Number required (unused) */
1229 };
1230 
1231 /* Quests, random or preset by the dungeon master */
1232 /* evileye - same as old quest type, but multiplayerized. */
1233 struct xorder_type {
1234 	u16b active;		/* quest is active? (num players) */
1235 	u16b id;		/* quest id */
1236 	s16b type;		/* Monster race or object type */
1237 	u16b flags;		/* Quest flags */
1238 	s32b creator;		/* Player ID or 0L (DM, guildmaster only) */
1239 	s32b turn;		/* quest started */
1240 };
1241 
1242 /* Adding this structure so we can have different creatures generated
1243    in different types of wilderness... this will probably be completly
1244    redone when I do a proper landscape generator.
1245    -APD-
1246 */
1247 
1248 /*
1249  * struct for individual levels.
1250  */
1251 typedef struct dun_level dun_level;
1252 struct dun_level {
1253 	int ondepth;
1254 	time_t lastused;
1255 	time_t total_static_time;
1256 	u32b id;		/* Unique ID to check if players logged out on the same
1257 				   floor or not, when they log in again- C. Blue */
1258 	byte up_x,up_y;
1259 	byte dn_x,dn_y;
1260 	byte rn_x,rn_y;
1261 
1262 	u32b flags1;		/* LF1 flags */
1263 	u32b flags2;		/* LF2 flags */
1264 	byte hgt;		/* Vault height */
1265 	byte wid;		/* Vault width */
1266 /*	char feeling[80] */	/* feeling description */
1267 	char *uniques_killed;
1268 
1269 	cave_type **cave;	/* Leave this the last entry (for aesthetic reason) */
1270 
1271 	int fake_town_num;	/* for dungeon stores: which town we abuse the stores from */
1272 
1273 	/* for obtaining statistical IDDC information: */
1274 	int monsters_generated, monsters_spawned, monsters_killed;
1275 };
1276 
1277 /* dungeon_type structure
1278  *
1279  * Filter for races is not strict. It shall alter the probability.
1280  * (consider using rule_type	- Jir -)
1281  */
1282 typedef struct dungeon_type dungeon_type;
1283 struct dungeon_type {
1284 	u16b id;		/* dungeon id */
1285 	u16b type;		/* dungeon type (of d_info) */
1286 	u16b baselevel;		/* base level (1 - 50ft etc). */
1287 	u32b flags1;		/* dungeon flags */
1288 	u32b flags2;		/* DF2 flags */
1289 	u32b flags3;		/* DF3 flags */
1290 	byte maxdepth;		/* max height/depth */
1291 #if 0
1292 	rule_type rules[5];	/* Monster generation rules */
1293 	char r_char[10];	/* races allowed */
1294 	char nr_char[10];	/* races prevented */
1295 #endif	/* 0 */
1296 	int store_timer;	/* control frequency of dungeon store generation (for misc iron stores mostly) */
1297 	byte theme;		/* inspired by IDDC themes - for 'wilderness' dungeons */
1298 	s16b quest, quest_stage;/* this dungeon was spawned by a quest? (for quest_info) quest==0 = no quest (it's q_idx + 1!) */
1299 
1300 	struct dun_level *level;	/* array of dungeon levels */
1301 };
1302 
1303 /*
1304  * TODO:
1305  * - allow towns to have dungeon flags(DFn_*)
1306  */
1307 struct town_type
1308 {
1309 	u16b x,y;		/* town wilderness location */
1310 	u16b baselevel;		/* Normally 0 for the basic town */
1311 	u16b flags;		/* town flags */
1312 	u16b num_stores;	/* always 8 or unused atm. */
1313 	store_type *townstore;  /* pointer to the stores */
1314 	u16b type;		/* town type (0=vanilla, 1=bree etc) */
1315 
1316 	u16b terraformed_trees; /* keep track of and limit players modifying town layout */
1317 	u16b terraformed_walls; /* keep track of and limit players modifying town layout */
1318 	u16b terraformed_water; /* keep track of and limit players modifying town layout */
1319 	u16b terraformed_glyphs; /* keep track of and limit players modifying town layout */
1320 
1321 	u32b dlev_id; /* for dungeon towns, abusing fake stores from real towns */
1322 	u16b dlev_depth; /* know the depth of this dungeon town, for determining store items */
1323 };
1324 
1325 typedef struct wilderness_type wilderness_type;
1326 
1327 struct wilderness_type {
1328 	u16b radius;	/* the distance from the town */
1329 	u16b type;	/* what kind of terrain we are in */
1330 	u16b town_lev;	/* difficulty level of the town that 'radius' refers to */
1331 	signed char town_idx;	/* Which town resides exactly in this sector? */
1332 
1333 	u32b flags;	/* various */
1334 	struct dungeon_type *tower;
1335 	struct dungeon_type *dungeon;
1336 	s16b ondepth;
1337 	time_t lastused;
1338 	time_t total_static_time;
1339 	cave_type **cave;
1340 	byte up_x, up_y;
1341 	byte dn_x, dn_y;
1342 	byte rn_x, rn_y;
1343 	s32b own;	/* King owning the wild */
1344 
1345 	/* client-side worldmap-sector-specific weather:
1346 	   (possible ideas for future: transmit x,y,wid,hgt weather frame
1347 	   for current level too instead of always using full size gen.) */
1348 	int weather_type, weather_wind, weather_wind_vertical, weather_intensity, weather_speed;
1349 	bool weather_updated; /* notice any change in local weather (like a PR_ flag would do) */
1350 	int clouds_to_update; /* number of clouds that were changed since last update (for efficiency) */
1351 	bool cloud_updated[10]; /* 'has cloud been changed?' */
1352 	int cloud_x1[10], cloud_y1[10], cloud_x2[10], cloud_y2[10], cloud_dsum[10], cloud_xm100[10], cloud_ym100[10], cloud_idx[10];
1353 
1354 	u16b bled;	/* type that was bled into this sector (USE_SOUND_2010: ambient sfx) */
1355 	bool ambient_sfx, ambient_sfx_counteddown, ambient_sfx_dummy; /* for synchronizing ambient sfx (USE_SOUND_2010) */
1356 	int ambient_sfx_timer;
1357 };
1358 
1359 
1360 /*
1361  * A store owner
1362  */
1363 
1364 typedef struct owner_type owner_type;
1365 
1366 struct owner_type
1367 {
1368 	u32b name;                      /* Name (offset) */
1369 
1370 	s32b max_cost;                  /* Purse limit */
1371 
1372 	byte max_inflate;               /* Inflation (max) */
1373 	byte min_inflate;               /* Inflation (min) */
1374 
1375 	byte haggle_per;                /* Haggle unit */
1376 
1377 	byte insult_max;                /* Insult limit */
1378 
1379 	s32b races[2][2];                  /* Liked/hated races */
1380 	s32b classes[2][2];                /* Liked/hated classes */
1381 	s32b realms[2][2];	/* Liked/hated realms */ /* unused */
1382 
1383 	s16b costs[3];                  /* Costs for liked people */
1384 };
1385 
1386 /*
1387  * A store/building type
1388  */
1389 /* I'd prefer 'store_kind'.. but just let's not change it */
1390 typedef struct store_info_type store_info_type;
1391 
1392 struct store_info_type
1393 {
1394 	u32b name;                      /* Name (offset) */
1395 
1396 	s16b table[STORE_CHOICES][2];   /* Table -- Legal item kinds */
1397 	byte table_num;                 /* Number of items */
1398 	s16b max_obj;                   /* Number of items this store can hold */
1399 
1400 	u16b owners[6];                 /* List of owners(refers to ow_info) */
1401 
1402 	u16b actions[6];                /* Actions(refers to ba_info) */
1403 
1404 	byte d_attr;			/* Default building attribute */
1405 	char d_char;			/* Default building character */
1406 
1407 	byte x_attr;			/* Desired building attribute */
1408 	char x_char;			/* Desired building character */
1409 
1410 	u32b flags1;                    /* Flags */
1411 };
1412 
1413 /*
1414  * Stores/buildings actions
1415  */
1416 typedef struct store_action_type store_action_type;
1417 
1418 struct store_action_type
1419 {
1420 	u32b name;                      /* Name (offset) */
1421 
1422 	int costs[3];			/* Costs for hated/neutral/liked people */
1423 	char letter;                    /* Action letter */
1424 	s16b action;                    /* Action code */
1425 	s16b action_restr;              /* Action restriction */
1426 	byte flags;		/* Client flags */
1427 };
1428 
1429 
1430 /*
1431  * The "name" of spell 'N' is stored as spell_names[X][N],
1432  * where X is 0 for mage-spells and 1 for priest-spells.
1433  */
1434 
1435 typedef struct magic_type magic_type;
1436 
1437 struct magic_type
1438 {
1439 	byte slevel;		/* Required level (to learn) */
1440 	byte smana;		/* Required mana (to cast) */
1441 	byte sfail;		/* Minimum chance of failure */
1442 	byte sexp;		/* Encoded experience bonus */
1443 	byte ftk;		/* Fire-till-kill class (0 = not possible, 1 = needs LOS, 2 = does't need LOS) */
1444 };
1445 
1446 
1447 /*
1448  * Information about the player's "magic"
1449  *
1450  * Note that a player with a "spell_book" of "zero" is illiterate.
1451  */
1452 
1453 typedef struct player_magic player_magic;
1454 
1455 struct player_magic
1456 {
1457 	s16b spell_book;		/* Tval of spell books (if any) */
1458 	s16b spell_stat;		/* Stat for spells (if any)  */
1459         magic_type info[64];	/* The available spells */
1460 };
1461 
1462 
1463 
1464 /*
1465  * Player racial info
1466  */
1467 
1468 typedef struct player_race player_race;
1469 
1470 struct player_race {
1471 	cptr title;		/* Type of race */
1472 
1473 	s16b r_adj[6];		/* Racial stat boni */
1474 
1475 	s16b r_dis;		/* disarming */
1476 	s16b r_dev;		/* magic devices */
1477 	s16b r_sav;		/* saving throw */
1478 	s16b r_stl;		/* stealth */
1479 	s16b r_srh;		/* search ability */
1480 	s16b r_fos;		/* search frequency */
1481 	s16b r_thn;		/* combat (normal) */
1482 	s16b r_thb;		/* combat (shooting) */
1483 
1484 	byte r_mhp;		/* Race hit-dice modifier */
1485 	s16b r_exp;		/* Race experience factor */
1486 
1487 	byte b_age;		/* base age */
1488 	byte m_age;		/* mod age */
1489 
1490 	byte m_b_ht;		/* base height (males) */
1491 	byte m_m_ht;		/* mod height (males) */
1492 	byte m_b_wt;		/* base weight (males) */
1493 	byte m_m_wt;		/* mod weight (males) */
1494 
1495 	byte f_b_ht;		/* base height (females) */
1496 	byte f_m_ht;		/* mod height (females)	  */
1497 	byte f_b_wt;		/* base weight (females) */
1498 	byte f_m_wt;		/* mod weight (females) */
1499 
1500 	byte infra;		/* Infra-vision	range */
1501 
1502         s32b choice;            /* Legal class choices depending on race */
1503 
1504         s16b mana;              /* % mana */
1505 
1506         struct {
1507                 s16b skill;
1508 
1509                 char vmod;
1510                 s32b value;
1511 
1512                 char mmod;
1513                 s16b mod;
1514         } skills[MAX_SKILLS];
1515 };
1516 
1517 
1518 /*
1519  * Player class info
1520  */
1521 
1522 typedef struct player_class player_class;
1523 
1524 struct player_class {
1525 	cptr title;			/* Type of class */
1526 
1527         byte color;                     /* @ color */
1528 
1529 	s16b c_adj[6];			/* Class stat modifier */
1530 	s16b min_recommend[6];		/* Recommended minimum stat just for informing the user */
1531 
1532 	s16b c_dis;			/* class disarming */
1533 	s16b c_dev;			/* class magic devices */
1534 	s16b c_sav;			/* class saving throws */
1535 	s16b c_stl;			/* class stealth */
1536 	s16b c_srh;			/* class searching ability */
1537 	s16b c_fos;			/* class searching frequency */
1538 	s16b c_thn;			/* class to hit (normal) */
1539 	s16b c_thb;			/* class to hit (bows) */
1540 
1541 	s16b x_dis;			/* extra disarming */
1542 	s16b x_dev;			/* extra magic devices */
1543 	s16b x_sav;			/* extra saving throws */
1544 	s16b x_stl;			/* extra stealth */
1545 	s16b x_srh;			/* extra searching ability */
1546 	s16b x_fos;			/* extra searching frequency */
1547 	s16b x_thn;			/* extra to hit (normal) */
1548 	s16b x_thb;			/* extra to hit (bows) */
1549 
1550 	s16b c_mhp;			/* Class hit-dice adjustment */
1551         s16b c_exp;			/* Class experience factor */
1552 
1553         struct {
1554                 s16b skill;
1555 
1556                 char vmod;
1557                 s32b value;
1558 
1559                 char mmod;
1560                 s16b mod;
1561         } skills[MAX_SKILLS];
1562 };
1563 
1564 
1565 /*
1566  * Player trait info, originally added for Draconians - C. Blue
1567  */
1568 typedef struct player_trait player_trait;
1569 
1570 struct player_trait
1571 {
1572 	cptr title;	/* Name of trait */
1573 	s32b choice;	/* Legal trait choices, depending on race */
1574 };
1575 
1576 
1577 /* The information needed to show a single "grid" */
1578 typedef struct cave_view_type cave_view_type;
1579 
1580 struct cave_view_type
1581 {
1582 	byte a;		/* Color attribute */
1583 	char c;		/* ASCII character */
1584 };
1585 
1586 /*
1587  * Information about a "party"
1588  */
1589 typedef struct party_type {
1590 	char name[MAX_CHARS];	/* Name of the party */
1591 	char owner[NAME_LEN];	/* Owner's name */
1592 	s32b members;		/* Number of people in the party */
1593 	s32b created;		/* Creation (or disband-tion) time */
1594 	byte cmode;		/* Party creator's character mode */
1595 	byte mode;		/* 'Iron Team' or normal party? (C. Blue) */
1596 	s32b experience;	/* For 'Iron Teams': Max experienc of members. */
1597 	u32b flags;		/* Party rules flags */
1598 } party_type;
1599 
1600 /*
1601  * Information about a guild.
1602  */
1603 
1604 /*
1605  * Guilds are semi permanent parties which allow party membership
1606  * at the same time as being a guild member. Experience is never
1607  * shared by guild members (unless in a party too). The guildmaster
1608  * has building privileges within the guild hall, and may alter
1609  * the layout of the hall at his/her discretion. Should the guild
1610  * master die, the guild is not disbanded, but he may drop a guild
1611  * key (if pkill is set) which will pass on ownership. A non member
1612  * picking this up, or the loss of the key (unstat etc.) will result
1613  * in a disputed guild where there is no master. In this case, the
1614  * position will be decided by some form of contest set by the
1615  * dungeon master. Should *all* guild members die, or commit suicide,
1616  * the guild will be disbanded, and the hall will be cleared and sold
1617  * to the bank in the same way houses are. (evileye)
1618  */
1619 typedef struct guild_type {
1620 	char name[MAX_CHARS];
1621 	s32b master;		/* Guildmaster unique player ID */
1622 	s32b members;		/* Number of guild members */
1623 	byte cmode;		/* Guild creator's character mode */
1624 	u32b flags;		/* Guild rules flags */
1625 	s16b minlev;		/* minimum level to join */
1626 	char adder[5][NAME_LEN];	/* Guild may have up to 5 people who can add besides the guild master */
1627 	s16b h_idx;		/* Guild Hall - house index */
1628 	u32b dna;		/* Remember the guild's identity - in case it times out and a new guild gets created of the same index */
1629 	int timeout;		/* Timer for removal of a guild that has been leaderless for too long */
1630 } guild_type;
1631 
1632 /* Save data work information for guild halls */
1633 
1634 struct guildsave{
1635 	FILE *fp;	/* the passed file pointer */
1636 	bool mode;	/* load=0 save=1 */
1637 };
1638 
1639 
1640 /*
1641  * Information about a "house"
1642  */
1643 typedef struct house_type house_type;
1644 
1645 /*
1646 In order to delete the contents of a house after its key is lost,
1647 added x_1, y_1, x_2, y_2, which are the locations of the opposite
1648 corners of the house.
1649 -APD-
1650 */
1651 struct house_type {
1652 	byte x, y;		/* Absolute starting coordinates */
1653 	byte dx, dy;		/* door coords */
1654 	struct dna_type *dna;	/* house dna door information */
1655 	u16b flags;		/* house flags - HF_xxxx */
1656 	struct worldpos wpos;
1657 	union {
1658 		struct { byte width, height; } rect;
1659 		char *poly;	/* coordinate array for non rect houses */
1660 	} coords;
1661 
1662 #ifndef USE_MANG_HOUSE_ONLY
1663 	s16b stock_num;		/* Stock -- Number of entries */
1664 	s16b stock_size;	/* Stock -- Total Size of Array */
1665 	object_type *stock;	/* Stock -- Actual stock items */
1666 #endif	/* USE_MANG_HOUSE_ONLY */
1667 
1668 	byte colour;		/* house colour for custom house painting (HOUSE_PAINTING) */
1669 	byte xtra;		/* unused; maybe for player stores if required */
1670 };
1671 
1672 struct dna_type{
1673 	u32b creator;		/* Unique ID of creator/house admin */
1674 	byte mode;		/* Creator's p_ptr->mode (normal, everlasting, pvp..) */
1675 	s32b owner;		/* Player/Party/Class/Race ID */
1676 	byte owner_type;	/* OT_xxxx */
1677 	byte a_flags;		/* Combination of ACF_xxxx */
1678 	u16b min_level;		/* minimum level - no higher than admin level */
1679 	u32b price;		/* Speed before memory */
1680 };
1681 
1682 /* evileye - work in progress */
1683 struct key_type{
1684 	u16b id;		/* key pval */
1685 };
1686 
1687 struct floor_insc{
1688 	char text[MAX_CHARS];	/* that should be enough */
1689 	u16b found;		/* we may want hidden inscription? */
1690 };
1691 
1692 
1693 #if 0
1694 /* Traditional, store-like house */
1695 struct trad_house_type
1696 {
1697 	struct dna_type *dna;	/* house dna door information */
1698 	s16b stock_num;			/* Stock -- Number of entries */
1699 	s16b stock_size;		/* Stock -- Total Size of Array */
1700 	object_type *stock;		/* Stock -- Actual stock items */
1701 };
1702 #endif	/* 0 */
1703 
1704 
1705 #if 0
1706 /*
1707  * Information about a "hostility"
1708  */
1709 typedef struct hostile_type hostile_type;
1710 
1711 struct hostile_type
1712 {
1713 	s32b id;		/* ID of player we are hostile to */
1714 	hostile_type *next;	/* Next in list */
1715 };
1716 #else
1717 /*
1718  * More general linked list for player id numbers
1719  */
1720 #define hostile_type player_list_type
1721 typedef struct player_list_type player_list_type;
1722 
1723 struct player_list_type
1724 {
1725 	s32b id;		/* ID of player */
1726 	player_list_type *next;
1727 };
1728 #endif
1729 
1730 /* remotely ignore players */
1731 struct remote_ignore
1732 {
1733 	unsigned int id;		/* player unique id */
1734 	short serverid;
1735 	struct remote_ignore *next;	/* Next in list */
1736 };
1737 
1738 #if 0 /* not finished - mikaelh */
1739 /*
1740  * ESP link list
1741  */
1742 typedef struct esp_link_type esp_link_type;
1743 struct esp_link_type
1744 {
1745 	s32b id;	/* player ID */
1746 	byte type;
1747 	u16b flags;
1748 	u16b end;
1749 	esp_link_type *next;
1750 };
1751 #endif
1752 
1753 /* The Troll Pit */
1754 /* Temporary banning of certain addresses */
1755 #if 0
1756 struct ip_ban {
1757 	struct ip_ban *next;	/* next ip in the list */
1758 	char ip[20];	/* so it shouldn't be really */
1759 	int time;	/* Time in minutes, or zero is permanent */
1760 };
1761 #else
1762 struct combo_ban {
1763 	struct combo_ban *next;	/* next ip in the list */
1764 	char ip[20];
1765 	char acc[NAME_LEN];
1766 	char hostname[MAX_CHARS];
1767 	char reason[MAX_CHARS];
1768 	int time;	/* Time in minutes, or zero is permanent */
1769 };
1770 #endif
1771 
1772 /*
1773  * Skills !
1774  */
1775 typedef struct skill_type skill_type;
1776 struct skill_type
1777 {
1778 	uintptr name;                              /* Name */
1779 	uintptr desc;                              /* Description */
1780 	uintptr action_desc;                       /* Action Description */
1781 
1782 	s16b action_mkey;                       /* Action do to */
1783 
1784 	s16b rate;                              /* Modifier decreasing rate */
1785 
1786 	s16b action[MAX_SKILLS];             /* List of actions against other skills in th form: action[x] = {SKILL_FOO, 10} */
1787 
1788 	s16b father;                            /* Father in the skill tree */
1789 	s16b order;                             /* Order in the tree */
1790 
1791 	u32b flags1;                            /* Skill flags */
1792 	byte tval;	/* tval associated */
1793 };
1794 
1795 /*
1796  * Skills of each player
1797  */
1798 typedef struct skill_player skill_player;
1799 struct skill_player
1800 {
1801 	s32b base_value;                         /* Base value */
1802 	s32b value;                             /* Actual value */
1803 	u16b mod;                               /* Modifier(1 skill point = modifier skill) */
1804 	bool dev;                               /* Is the branch developped ? */
1805 	bool touched;				/* need refresh? */
1806 	char flags1;                            /* Skill flags */
1807 };
1808 
1809 
1810 //todo, instead of ACC_GREETED, ACC_WARN_.. etc, maybe:	a dedicated 'u32b warnings;	/* account flags for received (one-time) hints/warnings */'
1811 struct account {
1812 	u32b id;	/* account id */
1813 	u32b flags;	/* account flags */
1814 	char name[30];	/* login */
1815 	char name_normalised[30];	/* login name, but in a simplified form, used for preventing creation of too similar account names */
1816 	char pass[20];	/* some crypts are not 13 */
1817 #ifdef ACC32
1818 	int acc_laston, acc_laston_real;
1819 #else
1820 	time_t acc_laston, acc_laston_real;	/* last time this account logged on (for expiry check) */
1821 #endif
1822 	s32b cheeze;	/* value in gold of cheezed goods or money */
1823 	s32b cheeze_self; /* value in gold of cheezed goods or money to own characters */
1824 	char deed_event;	/* receive a deed for a global event participation? */
1825 	char deed_achievement;	/* receive a deed for a (currently PvP) achievement? */
1826 	s32b guild_id;	/* auto-rejoin its guild after a char perma-died */
1827 	u32b guild_dna;	/* auto-rejoin its guild after a char perma-died */
1828 };
1829 /* Used for updating tomenet.acc structure: */
1830 struct account_old {
1831 	u32b id;	/* account id */
1832 	u32b flags;	/* account flags */
1833 	char name[30];	/* login */
1834 	char pass[20];	/* some crypts are not 13 */
1835 #ifdef ACC32
1836 	int acc_laston, acc_laston_real;
1837 #else
1838 	time_t acc_laston, acc_laston_real;	/* last time this account logged on (for expiry check) */
1839 #endif
1840 	s32b cheeze;	/* value in gold of cheezed goods or money */
1841 	s32b cheeze_self; /* value in gold of cheezed goods or money to own characters */
1842 	char deed_event;	/* receive a deed for a global event participation? */
1843 	char deed_achievement;	/* receive a deed for a (currently PvP) achievement? */
1844 	s32b guild_id;	/* auto-rejoin its guild after a char perma-died */
1845 	u32b guild_dna;	/* auto-rejoin its guild after a char perma-died */
1846 };
1847 
1848 typedef struct version_type version_type;
1849 
1850 struct version_type {		/* Extended version structure */
1851 	int major;
1852 	int minor;
1853 	int patch;
1854 	int extra;
1855 	int branch;
1856 	int build;
1857 
1858 	int os; /* after 4.4.8.1.0.0 */
1859 };
1860 
1861 typedef struct inventory_change_type inventory_change_type;
1862 
1863 /*
1864  * Structure for keeping track of inventory changes
1865  */
1866 struct inventory_change_type {
1867 	char type;
1868 	int revision;
1869 	s16b begin;
1870 	s16b end;
1871 	s16b mod;
1872 	inventory_change_type *next;
1873 };
1874 
1875 /*
1876  * Most of the "player" information goes here.
1877  *
1878  * This stucture gives us a large collection of player variables.
1879  *
1880  * This structure contains several "blocks" of information.
1881  *   (1) the "permanent" info
1882  *   (2) the "variable" info
1883  *   (3) the "transient" info
1884  *
1885  * All of the "permanent" info, and most of the "variable" info,
1886  * is saved in the savefile.  The "transient" info is recomputed
1887  * whenever anything important changes.
1888  */
1889 
1890 /*
1891  * high time to economize memory by bandling bool arrays into
1892  * char one or something, like in wild_map[MAX_WILD_8] ?	- Jir -
1893  */
1894 
1895 typedef struct player_type player_type;
1896 struct player_type {
1897 	int conn;			/* Connection number */
1898 	int Ind;			/* Self-reference */
1899 	char name[MAX_CHARS];		/* Nickname */
1900 	char basename[MAX_CHARS];	/* == Charactername (Nickname)? */
1901 	char realname[MAX_CHARS];	/* Userid (local machine's user name, default is 'PLAYER') */
1902 	char accountname[MAX_CHARS];
1903 	char hostname[MAX_CHARS];	/* His hostname */
1904 	char addr[MAX_CHARS];		/* His IP address */
1905 //	unsigned int version;		/* His version */
1906 	version_type version;
1907 	bool v_outdated, v_latest, v_test, v_test_latest, v_unknown;
1908 	bool rogue_like_commands;
1909 
1910 	s32b id;			/* Unique ID to each player */
1911 	u32b account;			/* account group id */
1912 	u32b dna;			/* DNA - psuedo unique to each player life */
1913 	s32b turn;			/* Player's birthday */
1914 	s32b turns_online;		/* How many turns this char has spent online */
1915 	s32b turns_afk;			/* How many turns this char has spent online while being /afk */
1916 	s32b turns_idle;		/* How many turns this char has spent online while being counted as 'idle' */
1917 	s32b turns_active;		/* How many turns this char has spent online while being neither 'idle' nor 'afk' at once */
1918 	time_t msg;			/* anti spamming protection */
1919 	byte msgcnt;
1920 	byte spam;
1921 	byte talk;			/* talk too much (moltors idea) */
1922 
1923 	player_list_type *hostile;	/* List of players we wish to attack */
1924 
1925 	char savefile[MAX_PATH_LENGTH];	/* Name of the savefile */
1926 
1927 	byte restricted;		/* account is restricted (ie after cheating) */
1928 	byte privileged;		/* account is privileged (ie for quest running) */
1929 	byte pvpexception;		/* account uses different pvp rules than server settings */
1930 	byte mutedchat;			/* account has chat restrictions */
1931 	bool inval;			/* Non validated account */
1932 	bool newly_created;		/* Just newly created char by player_birth()? */
1933 
1934 	bool alive;			/* Are we alive */
1935 	bool death;			/* Have we died */
1936 	bool safe_float;		/* for safe_float option */
1937 	int safe_float_turns;
1938 	bool safe_sane;			/* Save players from insanity-death on resurrection (atomic flag) - C. Blue */
1939 	int deathblow;			/* How much damage the final blow afflicted */
1940 	u16b deaths, soft_deaths;	/* Times this character died so far / safely-died (no real death) so far */
1941 	s16b ghost;			/* Are we a ghost */
1942 	s16b fruit_bat;			/* Are we a fruit bat */
1943 	byte lives;			/* number of times we have ressurected */
1944 	byte houses_owned;		/* number of simultaneously owned houses */
1945 	byte castles_owned;		/* number of owned castles */
1946 
1947 	byte prace;			/* Race index */
1948 	byte pclass;			/* Class index */
1949 	byte ptrait;
1950 	byte male;			/* Sex of character */
1951 //FREE
1952 	byte oops;			/* Unused */
1953 
1954 	skill_player s_info[MAX_SKILLS]; /* Player skills */
1955 	s16b skill_points;		/* number of skills assignable */
1956 
1957 	/* Copies for /undoskills - mikaelh */
1958 	skill_player s_info_old[MAX_SKILLS]; /* Player skills */
1959 	s16b skill_points_old;		/* number of skills assignable */
1960 	bool reskill_possible;
1961 
1962 	s16b class_extra;		/* Class extra info */
1963 
1964 	byte hitdie;			/* Hit dice (sides) */
1965 	s16b expfact;			/* Experience factor */
1966 
1967 //DEPRECATED
1968 	byte maximize;			/* Maximize stats */
1969 	byte preserve;			/* Preserve artifacts */
1970 
1971 	s16b age;			/* Characters age */
1972 	s16b ht;			/* Height */
1973 	s16b wt;			/* Weight */
1974 	s16b sc;			/* Social Class */
1975 
1976 //UNUSED but set in do_cmd_steal and do_life_scroll
1977 	u16b align_law;			/* alignment */
1978 	u16b align_good;
1979 
1980 	player_race *rp_ptr;		/* Pointers to player tables */
1981 	player_class *cp_ptr;
1982 	player_trait *tp_ptr;
1983 
1984 	s32b au;			/* Current Gold */
1985 
1986 	s32b max_exp;			/* Max experience */
1987 	s32b exp;			/* Cur experience */
1988 	u16b exp_frac;			/* Cur exp frac (times 2^16) */
1989 
1990 	s16b lev;			/* Level */
1991 	s16b max_lev;			/* Usual level after 'restoring life levels' */
1992 
1993 	s16b mhp;			/* Max hit pts */
1994 	s16b chp;			/* Cur hit pts */
1995 	u16b chp_frac;			/* Cur hit frac (times 2^16) */
1996 	s16b player_hp[PY_MAX_LEVEL];
1997 	s16b form_hp_ratio;		/* mimic form HP+ percentage */
1998 
1999 	s16b msp;			/* Max mana pts */
2000 	s16b csp;			/* Cur mana pts */
2001 	u16b csp_frac;			/* Cur mana frac (times 2^16) */
2002 
2003 	s16b mst;			/* Max stamina pts */
2004 	s16b cst;			/* Cur stamina pts */
2005 	s16b cst_frac;			/* 1/10000 */
2006 
2007 	object_type *inventory;		/* Player's inventory */
2008 	object_type *inventory_copy;	/* Copy of the last inventory sent to the client */
2009 
2010 	/* Inventory revisions */
2011 	inventory_change_type *inventory_changes; /* List of recent inventory changes */
2012 	int inventory_revision;		/* Current inventory ID */
2013 	char inventory_changed;		/* Inventory has changed since last update to the client */
2014 
2015 	s32b total_weight;		/* Total weight being carried */
2016 
2017 	s16b inven_cnt;			/* Number of items in inventory */
2018 	s16b equip_cnt;			/* Number of items in equipment */
2019 
2020 	s16b max_plv;			/* Max Player Level */
2021 	s16b max_dlv;			/* Max dungeon level explored. */
2022 	worldpos recall_pos;		/* what position to recall to */
2023 	u16b town_x, town_y;
2024 
2025 	int avoid_loc;			/* array size of locations to avoid when changing wpos (recalling) */
2026 	int *avoid_loc_x, *avoid_loc_y;
2027 
2028 	s16b stat_max[6];		/* Current "maximal" stat values */
2029 	s16b stat_cur[6];		/* Current "natural" stat values */
2030 
2031 	char history[4][60];		/* The player's "history" */
2032 
2033 	unsigned char wild_map[MAX_WILD_8]; /* the wilderness we have explored */
2034 
2035 	s16b py;			/* Player location in dungeon */
2036 	s16b px;
2037 
2038 	struct worldpos wpos;
2039 
2040 	s16b cur_hgt;			/* Height and width of their dungeon level */
2041 	s16b cur_wid;
2042 
2043 	bool new_level_flag;		/* Has this player changed depth? */
2044 	byte new_level_method;		/* Climb up stairs, down, or teleport level? */
2045 
2046 	/* changed from byte to u16b - mikaelh */
2047 	u16b party;			/* The party he belongs to (or 0 if neutral) */
2048 	byte guild;			/* The guild he belongs to (0 if neutral)*/
2049 	u32b guild_dna;			/* Remember the guild, to avoid confusion it was disbanded while we were offline */
2050 
2051 	s16b target_who;
2052 	s16b target_col;		/* What position is targetted */
2053 	s16b target_row;
2054 
2055 	s16b health_who;		/* Who's shown on the health bar */
2056 
2057 	s16b view_n;			/* Array of grids viewable to player */
2058 	byte view_y[VIEW_MAX];
2059 	byte view_x[VIEW_MAX];
2060 
2061 	s16b lite_n;			/* Array of grids lit by player lite */
2062 	byte lite_y[LITE_MAX];
2063 	byte lite_x[LITE_MAX];
2064 
2065 	s16b temp_n;			/* Array of grids used for various things */
2066 	byte temp_y[TEMP_MAX];
2067 	byte temp_x[TEMP_MAX];
2068 
2069 	s16b target_n;			/* Array of grids used for targetting/looking */
2070 	byte target_y[TEMP_MAX];
2071 	byte target_x[TEMP_MAX];
2072 	byte target_state[TEMP_MAX];
2073 	s16b target_idx[TEMP_MAX];
2074 
2075 	char infofile[MAX_PATH_LENGTH];	/* Temp storage of *ID* and Self Knowledge info */
2076 	char cur_file[MAX_PATH_LENGTH];	/* Filename this player's viewing */
2077 	char cur_file_title[MAX_CHARS];	/* Filename this player's viewing */
2078 	byte special_file_type;		/* Is he using *ID* or Self Knowledge? */
2079 
2080 	u32b dlev_id;			/* ID of the dungeon floor the player logged out on
2081 					   or 0 for surface, to decide about cave_flag reset. - C. Blue */
2082 	byte cave_flag[MAX_HGT][MAX_WID]; /* Can the player see this grid? */
2083 
2084 	bool mon_vis[MAX_M_IDX];	/* Can this player see these monsters? */
2085 	bool mon_los[MAX_M_IDX];
2086 
2087 	bool obj_vis[MAX_O_IDX];	/* Can this player see these objcets? */
2088 
2089 	bool play_vis[MAX_PLAYERS];	/* Can this player see these players? */
2090 	bool play_los[MAX_PLAYERS];
2091 
2092 	bool obj_aware[MAX_K_IDX];	/* Is the player aware of this obj type? */
2093 	bool obj_tried[MAX_K_IDX];	/* Has the player tried this obj type? */
2094 	bool obj_felt[MAX_K_IDX];	/* Has the player felt the value of this obj type via pseudo-id before? - C. Blue */
2095 	bool obj_felt_heavy[MAX_K_IDX];	/* Has the player had strong pseudo-id on this item? */
2096 
2097 	bool trap_ident[MAX_T_IDX];	/* do we know the name */
2098 
2099 	byte d_attr[MAX_K_IDX];
2100 	char d_char[MAX_K_IDX];
2101 	byte f_attr[MAX_F_IDX];
2102 	byte f_attr_solid[MAX_F_IDX];
2103 	char f_char[MAX_F_IDX];
2104 	char f_char_solid[MAX_F_IDX];
2105 	byte k_attr[MAX_K_IDX];
2106 	char k_char[MAX_K_IDX];
2107 	byte r_attr[MAX_R_IDX];
2108 	char r_char[MAX_R_IDX];
2109 
2110 	bool carry_query_flag;
2111 	bool use_old_target;
2112 	bool always_pickup;
2113 	bool stack_force_notes;
2114 	bool stack_force_costs;
2115 	bool short_item_names;
2116 
2117 	bool find_ignore_stairs;
2118 	bool find_ignore_doors;
2119 	bool find_cut;
2120 	bool find_examine;
2121 	bool disturb_move;
2122 	bool disturb_near;
2123 	bool disturb_panel;
2124 	bool disturb_state;
2125 	bool disturb_minor;
2126 	bool disturb_other;
2127 
2128 	bool alert_hitpoints;
2129 	bool alert_mana;
2130 	bool alert_afk_dam;
2131 	bool alert_offpanel_dam;
2132 	bool no_alert;
2133 	bool auto_afk;
2134 	bool newb_suicide;
2135 	bool stack_allow_items;
2136 	bool stack_allow_wands;
2137 	bool view_perma_grids;
2138 	bool view_torch_grids;
2139 
2140 	bool view_reduce_lite;
2141 	bool view_reduce_view;
2142 	bool view_lamp_floor;
2143 	bool view_lamp_walls;
2144 	bool view_shade_floor;
2145 	bool view_shade_walls;
2146 	bool wall_lighting;
2147 	bool floor_lighting;
2148 	bool view_animated_lite;
2149 	bool view_lite_extra;
2150 
2151 	/* TomeNET additions -- consider using macro or bitfield */
2152 	bool easy_open;
2153 	bool easy_disarm;
2154 	bool easy_tunnel;
2155 //	bool auto_destroy;
2156 	bool clear_inscr;
2157 	bool auto_inscribe;
2158 	bool taciturn_messages;
2159 	bool last_words;
2160 	bool limit_chat;
2161 	bool no_afk_msg;
2162 	/* bool speak_unique; */
2163 
2164 	/* 'make clean; make' consumes time :) */
2165 	bool depth_in_feet;
2166 	bool auto_target;
2167 	bool autooff_retaliator;
2168 	bool wide_scroll_margin;
2169 	bool always_repeat;
2170 	bool fail_no_melee;
2171 	bool dummy_option_7;
2172 	bool dummy_option_8;
2173 
2174 	bool page_on_privmsg;
2175 	bool page_on_afk_privmsg;
2176 	bool player_list;
2177 	bool player_list2;
2178 	bool auto_untag;
2179 	bool idle_starve_kick;
2180 	bool newbie_hints;
2181 	bool censor_swearing;
2182 	bool warn_unique_credit;
2183 	bool uniques_alive;
2184 	bool overview_startup;
2185 
2186 	s16b max_panel_rows, max_panel_cols;
2187 	s16b panel_row, panel_col;
2188 	s16b panel_row_min, panel_col_max;
2189 	s16b panel_col_min, panel_row_max;
2190 	s16b panel_row_prt, panel_col_prt; /* What panel this guy's on */
2191 	s16b panel_row_old, panel_col_old;
2192 #if 1	/* used for functions that still need to use the 'traditional' panel size of 66x22, eg magic mapping */
2193 	/* panel values assumed we'd use SCREEN_WID x SCREEN_HGT panels (and maybe for [x,y] location display) */
2194 	s16b max_tradpanel_rows, max_tradpanel_cols;
2195 	s16b tradpanel_row, tradpanel_col;
2196 	s16b tradpanel_row_min, tradpanel_col_min;
2197 	s16b tradpanel_row_max, tradpanel_col_max;
2198 #endif
2199 
2200 	s16b screen_wid;
2201 	s16b screen_hgt;
2202 
2203 	/* What he should be seeing */
2204 	cave_view_type scr_info[MAX_WINDOW_HGT][MAX_WINDOW_WID]; /* Hard-coded Y*X display */
2205 
2206 	/* Overlay layer used for detection */
2207 	cave_view_type ovl_info[MAX_WINDOW_HGT][MAX_WINDOW_WID]; /* Hard-coded Y*X display */
2208 
2209 	s32b mimic_seed;		/* seed for random mimic immunities etc. */
2210 	char mimic_immunity;		/* preferred immunity when mimicking (overrides mimic_seed) */
2211 
2212 	char died_from[MAX_CHARS];	/* What off-ed him */
2213 	char really_died_from[MAX_CHARS]; /* What off-ed him */
2214 	char died_from_list[MAX_CHARS]; /* what goes on the high score list */
2215 	s16b died_from_depth;		/* what depth we died on */
2216 
2217 	u16b total_winner;		/* Is this guy the winner */
2218 	u16b once_winner;		/* Has this guy ever been a winner */
2219 	bool iron_winner, iron_winner_ded; /* for those who beat the Ironman Deep Dive Challenge */
2220 	struct worldpos own1, own2;	/* IF we are a king what do we own ? */
2221 	u16b retire_timer;		/* The number of minutes this guy can play until
2222 					   he will be forcibly retired. */
2223 
2224 	u16b noscore;			/* Has he cheated in some way (hopefully not) */
2225 	s16b command_rep;		/* Command repetition */
2226 
2227 	byte last_dir;			/* Last direction moved (used for swapping places) */
2228 
2229 	s16b running;			/* Are we running */
2230 	byte find_current;		/* These are used for the running code */
2231 	byte find_prevdir;
2232 	bool find_openarea;
2233 	bool find_breakright;
2234 	bool find_breakleft;
2235 	bool running_on_floor;		/* Are we running on normal floor, or over grids that we have special abilities to actually pass */
2236 
2237 	bool resting;			/* Are we resting? */
2238 	s16b energy_use;		/* How much energy has been used */
2239 
2240 	int look_index;			/* Used for looking or targeting */
2241 
2242 	s32b current_char;
2243 	s16b current_spell;		/* Spell being cast */
2244 	s16b current_realm;		/* Realm of spell being cast */
2245 	s16b current_mind;		/* Power being use */
2246 	/* XXX XXX consider using union or sth */
2247 	s16b current_rod;		/* Rod being zapped */
2248 	s16b current_activation;	/* Artifact (or dragon mail) being activated */
2249 	s16b current_enchant_h;		/* Current enchantments */
2250 	s16b current_enchant_d;
2251 	s16b current_enchant_a;
2252 	s16b current_enchant_flag;
2253 	s16b current_identify;		/* Are we identifying something? */
2254 	s16b current_star_identify;
2255 	s16b current_recharge;
2256 	s16b current_artifact;
2257 	bool current_artifact_nolife;
2258 	object_type *current_telekinesis;
2259 #ifdef TELEKINESIS_GETITEM_SERVERSIDE
2260 	s16b current_telekinesis_mw;
2261 #endif
2262 	s16b current_curse;
2263 	s16b current_tome_creation;	/* adding a spell scroll to a custom tome - C. Blue */
2264 	s16b current_rune;
2265 	s16b current_force_stack;	/* which level 0 item we're planning to stack */
2266 	s16b current_wand;
2267 	s16b current_item;
2268 	s16b current_aux;
2269 	s16b current_fire;
2270 	s16b current_throw;
2271 	s16b current_book;
2272 	s16b current_rcraft;
2273 	u16b current_rcraft_e_flags;
2274 	u16b current_rcraft_m_flags;
2275 	s16b current_breath;
2276 	s16b current_selling;
2277 	s16b current_sell_amt;
2278 	int current_sell_price;
2279 	bool current_create_sling_ammo;
2280 
2281 	int using_up_item;		/* Item being used up while enchanting, *ID*ing etc. */
2282 
2283 	int store_num;			/* What store this guy is in */
2284 #ifdef PLAYER_STORES
2285 	int ps_house_x, ps_house_y;	/* coordinates of the house linked to current player store */
2286 	int ps_mcheque_x;		/* Index or x-coordinate of existing mass-cheque in the house */
2287 	int ps_mcheque_y;		/* y-coordinate of existing mass-cheque in the house */
2288 #endif
2289 
2290 	s16b fast;			/* Timed -- Fast */
2291 	s16b fast_mod;   		/* Timed -- Fast */
2292 	s16b slow;			/* Timed -- Slow */
2293 	s16b blind;			/* Timed -- Blindness */
2294 	s16b paralyzed;			/* Timed -- Paralysis */
2295 	s16b confused;			/* Timed -- Confusion */
2296 	s16b afraid;			/* Timed -- Fear */
2297 	s16b image;			/* Timed -- Hallucination */
2298 	s16b poisoned;			/* Timed -- Poisoned */
2299 	s16b slow_poison;
2300 	int poisoned_attacker;		/* Who poisoned the player - used for blood bond */
2301 	s16b cut;			/* Timed -- Cut */
2302 	int cut_attacker;		/* Who cut the player - used for blood bond */
2303 	s16b stun;			/* Timed -- Stun */
2304 
2305 	s16b xtrastat;			/* timed temp +stats */
2306 	s16b statval;			/* which */
2307 	byte xstr;
2308 	byte xint;
2309 	byte xdex;
2310 	byte xcon;
2311 	byte xchr;
2312 
2313 	s16b focus_time;		/* focus shot */
2314 	s16b focus_val;
2315 
2316 	s16b protevil;			/* Timed -- Protection */
2317 	s16b zeal;			/* timed EA bonus */
2318 	s16b zeal_power;
2319 	s16b martyr;
2320 	s16b martyr_timeout;
2321 	s16b martyr_dur;
2322 	s16b res_fear_temp;
2323 	s16b invuln, invuln_applied;	/* Timed -- Invulnerable; helper var */
2324 	s16b invuln_dur;		/* How long this invuln was when it started */
2325 	s16b hero;			/* Timed -- Heroism */
2326 	s16b shero;			/* Timed -- Super Heroism */
2327 	s16b berserk;			/* Timed -- Berserk #2 */
2328 	s16b fury;			/* Timed -- Furry */
2329 	s16b tim_thunder;		/* Timed thunderstorm */
2330 	s16b tim_thunder_p1;		/* Timed thunderstorm */
2331 	s16b tim_thunder_p2;		/* Timed thunderstorm */
2332 	s16b tim_ffall;			/* Timed Feather Falling */
2333 	s16b tim_lev;			/* Timed Levitation */
2334 	s16b shield;			/* Timed -- Shield Spell */
2335 	s16b shield_power;		/* Timed -- Shield Spell Power */
2336 	s16b shield_opt;		/* Timed -- Shield Spell options */
2337 	s16b shield_power_opt;		/* Timed -- Shield Spell Power */
2338 	s16b shield_power_opt2;		/* Timed -- Shield Spell Power */
2339 	s16b tim_regen;			/* Timed extra regen */
2340 	s16b tim_regen_pow;		/* Timed extra regen power */
2341 	s16b blessed;			/* Timed -- Blessed */
2342 	s16b blessed_power;		/* Timed -- Blessed */
2343 	s16b tim_invis;			/* Timed -- See Invisible */
2344 	s16b tim_infra;			/* Timed -- Infra Vision */
2345 	s16b tim_wraith;		/* Timed -- Wraithform */
2346 	u16b tim_jail;			/* Timed -- Jailed */
2347 	u16b tim_susp;			/* Suspended sentence (dungeon) */
2348 	u16b tim_pkill;			/* pkill changeover timer */
2349 	u16b pkill;			/* pkill flags */
2350 	u16b tim_store;			/* timed -- how long (s)he can stay in a store */
2351 	bool wraith_in_wall;		/* currently no effect! */
2352 	s16b tim_meditation;		/* Timed -- Meditation */
2353 	s16b tim_invisibility;		/* Timed -- Invisibility */
2354 	s16b tim_invis_power;		/* Timed -- Invisibility Power (perm) */
2355 	s16b tim_invis_power2;		/* Timed -- Invisibility Power (temp) */
2356 	s16b tim_traps;			/* Timed -- Avoid traps */
2357 	s16b tim_manashield;		/* Timed -- Mana Shield */
2358 	s16b tim_mimic;			/* Timed -- Mimicry */
2359 	s16b tim_mimic_what;		/* Timed -- Mimicry */
2360 //UNUSED just queried
2361 	s16b bow_brand;			/* Timed -- Bow Branding */
2362 	byte bow_brand_t;		/* Timed -- Bow Branding */
2363 	s16b bow_brand_d;		/* Timed -- Bow Branding */
2364 	s16b brand;			/* Timed -- Weapon Branding (used by runecraft) */
2365 	byte brand_t;			/* Timed -- Weapon Branding */
2366 	s16b brand_d;			/* Timed -- Weapon Branding */
2367 	bool brand_fire;		/* Added for Draconians, but could clean up a lot of tot_dam_aux.. code too */
2368 	bool brand_cold;
2369 	bool brand_elec;
2370 	bool brand_acid;
2371 	bool brand_pois;
2372 	s16b prob_travel;		/* Timed -- Probability travel */
2373 	s16b st_anchor;			/* Timed -- Space/Time Anchor */
2374 	s16b tim_esp;			/* Timed -- ESP */
2375 	s16b adrenaline;
2376 	s16b biofeedback;
2377 	s16b mindboost;
2378 	s16b mindboost_power;
2379 	s16b kinetic_shield;
2380 
2381 	s16b auto_tunnel;
2382 	s16b body_monster;
2383 	bool dual_wield;		/* Currently wielding 2 one-handers at once */
2384 
2385 	s16b bless_temp_luck;		/* Timed blessing - luck */
2386 	s16b bless_temp_luck_power;
2387 
2388 	s16b oppose_acid;		/* Timed -- oppose acid */
2389 	s16b oppose_elec;		/* Timed -- oppose lightning */
2390 	s16b oppose_fire;		/* Timed -- oppose heat */
2391 	s16b oppose_cold;		/* Timed -- oppose cold */
2392 	s16b oppose_pois;		/* Timed -- oppose poison */
2393 
2394 	s16b word_recall;		/* Word of recall counter */
2395 
2396 	s16b energy;			/* Current energy */
2397 	bool requires_energy;		/* Player requires energy to perform a normal action instead of shooting-till-kill (and auto-retaliating?) */
2398 
2399 	s16b food;			/* Current nutrition */
2400 
2401 	byte confusing;			/* Glowing hands */
2402 	byte stunning;			/* Heavy hands */
2403 	byte searching;			/* Currently searching */
2404 
2405 	bool old_cumber_armor;
2406 	bool old_awkward_armor;
2407 	bool old_cumber_glove;
2408 	bool old_cumber_helm;
2409 	bool old_heavy_wield;
2410 	bool old_heavy_shield;
2411 	bool old_heavy_shoot;
2412 	bool old_icky_wield;
2413 	bool old_awkward_wield;
2414 	bool old_easy_wield;
2415 	bool old_cumber_weight;
2416 	bool old_monk_heavyarmor;
2417 	bool old_awkward_shoot;
2418 	bool old_rogue_heavyarmor;
2419 	bool old_heavy_swim;
2420 
2421 	s16b old_lite;			/* Old radius of lite (if any) */
2422 	s16b old_vlite;			/* Old radius of virtual lite (if any) */
2423 	s16b old_view;			/* Old radius of view (if any) */
2424 
2425 	s16b old_food_aux;		/* Old value of food */
2426 
2427 	bool cumber_armor;		/* Encumbering armor (tohit/sneakiness) */
2428 	bool awkward_armor;		/* Mana draining armor */
2429 	bool cumber_glove;		/* Mana draining gloves */
2430 	bool cumber_helm;		/* Mana draining headgear */
2431 	bool heavy_wield;		/* Heavy weapon */
2432 	bool heavy_shield;		/* Heavy shield */
2433 	bool heavy_shoot;		/* Heavy shooter */
2434 	bool icky_wield;		/* Icky weapon */
2435 	bool awkward_wield;		/* shield and COULD_2H weapon */
2436 	bool easy_wield;		/* Using a 1-h weapon which is MAY2H with both hands */
2437 	bool cumber_weight;		/* Full weight. FA from MA will be lost if overloaded */
2438 	bool monk_heavyarmor;		/* Reduced MA power? */
2439 	bool awkward_shoot;		/* using ranged weapon while having a shield on the arm */
2440 	bool rogue_heavyarmor;		/* No AoE-searching? Encumbered dual-wield? */
2441 	bool heavy_swim;		/* Too heavy to swim without drowning chance? */
2442 
2443 	s16b cur_lite;			/* Radius of lite (if any) */
2444 	s16b cur_vlite;			/* radius of virtual light (not visible to others) */
2445 	byte lite_type;
2446 
2447 
2448 	u32b notice;			/* Special Updates (bit flags) */
2449 	u32b update;			/* Pending Updates (bit flags) */
2450 	u32b redraw;			/* Normal Redraws (bit flags) */
2451 	u32b window;			/* Window Redraws (bit flags) */
2452 
2453 	s16b stat_use[6];		/* Current modified stats */
2454 	s16b stat_top[6];		/* Maximal modified stats */
2455 
2456 	s16b stat_add[6];		/* Modifiers to stat values */
2457 	s16b stat_ind[6];		/* Indexes into stat tables */
2458 
2459 	s16b stat_cnt[6];		/* Counter for temporary drains */
2460 	s16b stat_los[6];		/* Amount of temporary drains */
2461 
2462 	bool immune_acid;		/* Immunity to acid */
2463 	bool immune_elec;		/* Immunity to lightning */
2464 	bool immune_fire;		/* Immunity to fire */
2465 	bool immune_cold;		/* Immunity to cold */
2466 
2467 //UNUSED just queried
2468 	s16b reduc_fire;		/* Fire damage reduction */
2469 	s16b reduc_elec;		/* elec damage reduction */
2470 	s16b reduc_acid;		/* acid damage reduction */
2471 	s16b reduc_cold;		/* cold damage reduction */
2472 
2473 	bool resist_acid;		/* Resist acid */
2474 	bool resist_elec;		/* Resist lightning */
2475 	bool resist_fire;		/* Resist fire */
2476 	bool resist_cold;		/* Resist cold */
2477 	bool resist_pois;		/* Resist poison */
2478 
2479 	bool resist_conf;		/* Resist confusion */
2480 	bool resist_sound;		/* Resist sound */
2481 	bool resist_lite;		/* Resist light */
2482 	bool resist_dark;		/* Resist darkness */
2483 	bool resist_chaos;		/* Resist chaos */
2484 	bool resist_disen;		/* Resist disenchant */
2485 	bool resist_shard;		/* Resist shards */
2486 	bool resist_nexus;		/* Resist nexus */
2487 	bool resist_blind;		/* Resist blindness */
2488 	bool resist_neth;		/* Resist nether */
2489 	bool resist_fear;		/* Resist fear */
2490 
2491 	bool sustain_str;		/* Keep strength */
2492 	bool sustain_int;		/* Keep intelligence */
2493 	bool sustain_wis;		/* Keep wisdom */
2494 	bool sustain_dex;		/* Keep dexterity */
2495 	bool sustain_con;		/* Keep constitution */
2496 	bool sustain_chr;		/* Keep charisma */
2497 
2498 	bool aggravate;			/* Aggravate monsters */
2499 	bool teleport;			/* Random teleporting */
2500 
2501 	bool feather_fall;		/* No damage falling */
2502 	bool lite;			/* Permanent light */
2503 	bool free_act;			/* Never paralyzed */
2504 	bool see_inv;			/* Can see invisible */
2505 	bool regenerate;		/* Regenerate hit pts */
2506 	bool resist_time;		/* Resist time */
2507 	bool resist_mana;		/* Resist mana */
2508 	bool immune_poison;		/* Poison immunity */
2509 	bool immune_water;		/* Makes immune to water */
2510 	bool resist_water;		/* Resist Water */
2511 	bool resist_plasma;		/* Resist Plasma */
2512 	bool regen_mana;		/* Regenerate mana */
2513 	bool hold_life;			/* Resist life draining */
2514 	u32b telepathy;			/* Telepathy */
2515 	bool slow_digest;		/* Slower digestion */
2516 	bool bless_blade;		/* Blessed blade */
2517 	byte xtra_might;		/* Extra might bow */
2518 	bool impact;			/* Earthquake blows */
2519         bool auto_id;			/* Pickup = Id */
2520 	bool reduce_insanity;		/* For mimic forms with weird/empty mind */
2521 
2522 	s16b invis;			/* Invisibility */
2523 
2524 	s16b dis_to_h;			/* Known bonus to hit */
2525 	s16b dis_to_d;			/* Known bonus to dam */
2526 	s16b dis_to_h_ranged;		/* Known bonus to hit */
2527 	s16b dis_to_d_ranged;		/* Known bonus to dam */
2528 	s16b dis_to_a;			/* Known bonus to ac */
2529 	s16b dis_ac;			/* Known base ac */
2530 
2531 	s16b to_h_ranged;		/* Bonus to hit */
2532 	s16b to_d_ranged;		/* Bonus to dam */
2533 	s16b to_h_melee;		/* Bonus to hit */
2534 	s16b to_d_melee;		/* Bonus to dam */
2535 	s16b to_h;			/* Bonus to hit */
2536 	s16b to_d;			/* Bonus to dam */
2537 	s16b to_a;			/* Bonus to ac */
2538 
2539 	s16b ac;			/* Base ac */
2540 
2541 	/* just for easy LUA handling; not game-play relevant: */
2542 	s16b overall_tohit_r, overall_todam_r, overall_tohit_m, overall_todam_m;
2543 
2544 	s16b see_infra;			/* Infravision range */
2545 
2546 	s16b skill_dis;			/* Skill: Disarming */
2547 	s16b skill_dev;			/* Skill: Magic Devices */
2548 	s16b skill_sav;			/* Skill: Saving throw */
2549 	s16b skill_stl;			/* Skill: Stealth factor */
2550 	s16b skill_srh;			/* Skill: Searching ability */
2551 	s16b skill_fos;			/* Skill: Searching frequency */
2552 	s16b skill_thn;			/* Skill: To hit (normal) */
2553 	s16b skill_thb;			/* Skill: To hit (shooting) */
2554 	s16b skill_tht;			/* Skill: To hit (throwing) */
2555 	s16b skill_dig;			/* Skill: Digging */
2556 
2557 	s16b num_blow;			/* Number of blows */
2558 	s16b num_fire;			/* Number of shots */
2559 	s16b num_spell;			/* Number of spells */
2560 
2561 	byte tval_xtra;			/* Correct xtra tval */
2562 	byte tval_ammo;			/* Correct ammo tval */
2563 	s16b pspeed;			/* Current speed */
2564 
2565  	s16b r_killed[MAX_R_IDX];	/* Monsters killed */
2566 
2567 	s32b melee_techniques_old;	/* melee techniques before last skill point update */
2568 	s32b melee_techniques;		/* melee techniques */
2569 	s32b ranged_techniques_old;	/* ranged techniques before last skill point update */
2570 	s32b ranged_techniques;		/* ranged techniques */
2571 	s32b innate_spells[3];		/* Monster spells */
2572 	bool body_changed;
2573 
2574 	bool anti_magic;		/* Can the player resist magic */
2575 
2576 	player_list_type *blood_bond;	/* Norc is now happy :) */
2577 
2578 	byte mode;			/* Difficulty MODE */
2579 
2580 #if 1
2581 	s32b esp_link;			/* Mental link */
2582 	byte esp_link_type;
2583 	u16b esp_link_flags;
2584 	u16b esp_link_end;		/* Time before actual end */
2585 #else
2586 	/* new esp link stuff - mikaelh */
2587 	esp_link_type *esp_link;	/* Mental link */
2588 	u16b esp_link_flags;		/* Some flags */
2589 #endif
2590 	bool (*master_move_hook)(int Ind, char *args);
2591 
2592 	/* some new borrowed flags (saved) */
2593 	bool black_breath;		/* The Tolkien's Black Breath */
2594 	bool black_breath_tmp;		/* (NOT saved) BB induced by an item */
2595 	/*u32b malady;*/		/* TODO: Flags for malady */
2596 
2597 	s16b msane;			/* Max sanity */
2598 	s16b csane;			/* Cur sanity */
2599 	u16b csane_frac;		/* Cur sanity frac */
2600 	byte sanity_bar;		/* preferred type of SN: bar, if player has sufficient Health skill */
2601 
2602 	/* elements under this line won't be saved...for now. - Jir - */
2603 	player_list_type *ignore;	/* List of players whose chat we wish to ignore */
2604 	struct remote_ignore *w_ignore;	/* List of players whose chat we wish to ignore */
2605 	long int idle;			/* player is idling for <idle> seconds.. */
2606 	long int idle_char;		/* character is idling for <idle_char> seconds (player still might be chatting etc) */
2607 	bool afk;			/* player is afk */
2608 	char afk_msg[MAX_CHARS];	/* afk reason */
2609 	char info_msg[MAX_CHARS];	/* public info message (display gets overridden by an afk reason, if specified) */
2610 //CHECK
2611 	bool use_r_gfx;			/* hack - client uses gfx? */
2612 	player_list_type *afk_noticed;	/* Only display AFK messages once in private conversations */
2613 
2614 	byte drain_exp;			/* Experience draining */
2615 	byte drain_life;		/* hp draining */
2616 	byte drain_mana;		/* mana draining */
2617 
2618 	bool suscep_fire;		/* Fire does more damage on the player */
2619 	bool suscep_cold;		/* Cold does more damage on the player */
2620 	bool suscep_acid;		/* Acid does more damage on the player */
2621 	bool suscep_elec;		/* Electricity does more damage on the player */
2622 	bool suscep_pois;		/* Poison does more damage on the player */
2623 	bool suscep_lite;		/* Light does more damage on the player */
2624 	bool suscep_good;		/* Anti-evil effects do more damage on the player */
2625 	bool suscep_evil;		/* Anti-good effects do more damage on the player */
2626 	bool suscep_life;		/* Anti-undead effects do more damage on the player */
2627 
2628 	bool reflect;			/* Reflect 'bolt' attacks */
2629 	int shield_deflect;		/* Deflect various attacks (ranged), needs USE_BLOCKING */
2630 	int weapon_parry;		/* Parry various attacks (melee), needs USE_PARRYING */
2631 	bool no_cut;			/* For mimic forms */
2632 	bool sh_fire;			/* Fiery 'immolation' effect */
2633 	bool sh_fire_tim, sh_fire_fix;
2634 	bool sh_elec;			/* Electric 'immolation' effect */
2635 	bool sh_elec_tim, sh_elec_fix;
2636 	bool sh_cold;			/* Cold 'immolation' effect */
2637 	bool sh_cold_tim, sh_cold_fix;
2638 	bool wraith_form;		/* wraithform */
2639 	bool immune_neth;		/* Immunity to nether */
2640 	bool climb;			/* Can climb mountains */
2641 	bool levitate;			/* Can levitate over some features */
2642 	bool can_swim;			/* Can swim like a fish (or Lizard..whatever) */
2643 	bool pass_trees;		/* Can pass thick forest */
2644 	bool town_pass_trees;		/* Can pass forest in towns, as an exception to make movement easier */
2645 
2646 	int luck;			/* Extra luck of this player */
2647 
2648 	/*byte anti_magic_spell;*/	/* Anti-magic(newer one..) */
2649 	byte antimagic;    		/* Anti-magic(in percent) */
2650 	byte antimagic_dis;		/* Radius of the anti magic field */
2651 	bool anti_tele;			/* Prevent any teleportation + phasing + recall */
2652 	bool res_tele;			/* Prevents being teleported from someone else */
2653 	bool resist_continuum;		/* non-timed -- Space/Time Anchor - in PernM, it's same as st_anchor */
2654 	bool admin_wiz;			/* Is this char Wizard? */
2655 	bool admin_dm;			/* or Dungeon Master? */
2656 	bool admin_dm_chat;		/* allow players to send private chat to an invisible DM */
2657 	bool stormbringer;		/* Attack friends? */
2658 	int vampiric_melee;		/* vampiric in close combat? */
2659 	int vampiric_ranged;		/* shots have vampiric effects? */
2660 	int vamp_fed_midx;		/* monster we fed from */
2661 
2662 	bool ty_curse;			/* revived these two, in different forms */
2663 	bool dg_curse;
2664 
2665 	u16b xorder_id;			/* Extermination order number */
2666 	s16b xorder_num;		/* Number of kills needed */
2667 
2668 	s16b xtra_crit;			/* critical strike bonus from item */
2669 	s16b extra_blows;		/* Number of extra blows */
2670 
2671 	s16b to_l;			/* Bonus to life */
2672 	s32b to_hp;			/* Bonus to Hit Points */
2673 	s16b to_m;			/* Bonus to mana */
2674 	//s16b to_s;			/* Bonus to spell(num_spell) */
2675 	s16b dodge_level;		/* Chance of dodging blows/missiles */
2676 
2677 	s32b balance;			/* Deposit/debt */
2678 	s32b tim_blacklist;		/* Player is on the 'Black List' (he gets penalties in shops) */
2679 	s32b tim_watchlist;		/* Player is on the 'Watch List' (he may not steal) */
2680 	s32b pstealing;			/* Player has just tried to steal from another player. Cooldown timer. */
2681 	int ret_dam;                    /* Drained life from a monster */
2682 	char attacker[MAX_CHARS];	/* Monster doing a ranged attack on the player */
2683 #if 0
2684 	s16b mtp;			/* Max tank pts */
2685 	s16b ctp;			/* Cur tank pts */
2686 	s16b tp_aux1;			/* aux1 tank pts */
2687 	s16b tp_aux2;			/* aux2 tank pts */
2688 
2689 	s32b grace;			/* Your God's appreciation factor. */
2690 	byte pgod;			/* Your God. */
2691 	bool praying;			/* Praying to your god. */
2692 	s16b melkor_sacrifice;		/* How much hp has been sacrified for damage */
2693 #endif	/* 0 */
2694 
2695 	byte spell_project;		/* Do the spells(some) affect nearby party members ? */
2696 
2697 	/* Special powers */
2698 //UNUSED
2699 	s16b powers[MAX_POWERS];	/* What powers do we possess? */
2700 	s16b power_num;			/* How many */
2701 
2702 	/* evileye games */
2703 	s16b team;			/* what team */
2704 
2705 #ifdef ARCADE_SERVER
2706 	/* Moltor's arcade crap */
2707 	int arc_a, arc_b, arc_c, arc_d, arc_e, arc_f, arc_g, arc_h, arc_i, arc_j, arc_k, arc_l;
2708 	char firedir;
2709 	char game;
2710 	int gametime;
2711 	char pushed;
2712 	char pushdir;
2713 #endif
2714 
2715 	bool panic;			/* C. Blue - was the last shutdown a panic save? */
2716 
2717 	/* Anti-cheeze */
2718 	s16b supp, supp_top;		/* level of the highest supporter (who casted buffs/heals on us) */
2719 	s16b support_timer;		/* safe maximum possible duration of the support spells */
2720 
2721 	byte updated_savegame;		/* any automatic savegame update to perform? (toggle) */
2722 	byte artifact_reset;		/* for automatic artifact reset (similar to updated_savegame) */
2723 	bool fluent_artifact_reset;
2724 	s16b corner_turn;		/* C. Blue - Fun stuff :) Make player vomit if he turns around ***a lot*** (can't happen in 'normal' gameplay) */
2725 	byte auto_transport;		/* automatic (scripted) transport sequences */
2726 	byte paging;			/* Player being paged by others? (Beep counter) */
2727 	bool ignoring_chat;		/* Ignoring normal chat? (Will only see private & party messages then) */
2728 	bool muted;			/* Being an ass? - the_sandman */
2729 	byte has_pet;			/* Pet limiter */
2730 	/* Is the player auto-retaliating? (required for hack that fixes a lock bug) */
2731 	bool auto_retaliating;
2732 	bool auto_retaliaty;		/* TRUE for code-wise duration of autorataliation
2733 					   actions, to prevent going un-AFK from them! */
2734 
2735 	/* Global events participant? */
2736 	int global_event_type[MAX_GLOBAL_EVENTS]; /* 0 means 'not participating' */
2737 	time_t global_event_signup[MAX_GLOBAL_EVENTS];
2738 	time_t global_event_started[MAX_GLOBAL_EVENTS];
2739 	u32b global_event_progress[MAX_GLOBAL_EVENTS][4];
2740 	u32b global_event_temp; /* not saved. see defines.h for details */
2741 	int global_event_participated[MAX_GLOBAL_EVENT_TYPES];
2742 
2743 	/* Had a quest running when he logged out or something? ->respawn/reactivate quest? todo//unclear yet..
2744 	   THIS IS NEW STUFF: quest_info. Don't confuse it with older quest_type/quest[]/plots[] code sketches in bldg.c. */
2745 	int interact_questor_idx;	/* id in QI_QUESTORS, which questor we just interacted with (bumped into) */
2746 	s16b quest_idx[MAX_CONCURRENT_QUESTS];
2747 	char quest_codename[MAX_CONCURRENT_QUESTS][10 + 1]; /* track up to 5 quests by their codename and roughly the current stage and goals */
2748 	s32b quest_acquired[MAX_CONCURRENT_QUESTS]; /* the turn when it was acquired */
2749 	s32b quest_timed_stage_change[MAX_CONCURRENT_QUESTS]; /* turn tracker for automatically timed stage change */
2750 	s16b quest_stage[MAX_CONCURRENT_QUESTS]; /* in which stage is a quest? */
2751 	s16b quest_stage_timer[MAX_CONCURRENT_QUESTS]; /* stage automatics started a timer leading to stage completion */
2752 	u16b quest_flags[MAX_CONCURRENT_QUESTS]; /* our personal quest flags configuration */
2753 	bool quest_goals[MAX_CONCURRENT_QUESTS][QI_GOALS]; /* which goals have we completed so far? */
2754 	bool quest_goals_nisi[MAX_CONCURRENT_QUESTS][QI_GOALS]; /* which goals have we completed so far? */
2755 	s16b quest_kill_number[MAX_CONCURRENT_QUESTS][QI_GOALS]; /* which goals have we completed so far? */
2756 	s16b quest_retrieve_number[MAX_CONCURRENT_QUESTS][QI_GOALS]; /* which goals have we completed so far? */
2757 	/* permanent quest info */
2758 	s16b quest_done[MAX_Q_IDX];	/* player has completed a quest (n times) */
2759 	s16b quest_cooldown[MAX_Q_IDX];	/* player has to wait n minutes till picking up the quest again */
2760 	/* for 'individual' quests: */
2761 	/* quest helper info */
2762 	bool quest_any_k, quest_any_k_target, quest_any_k_within_target; /* just roughly remember in general whether ANY of our quests needs killing/retrieving (and maybe only in a particular location) */
2763 	bool quest_any_r, quest_any_r_target, quest_any_r_within_target; /* just roughly remember in general whether ANY of our quests needs killing/retrieving (and maybe only in a particular location) */
2764 	bool quest_any_deliver_xy, quest_any_deliver_xy_within_target;
2765 	bool quest_kill[MAX_CONCURRENT_QUESTS];
2766 	bool quest_retrieve[MAX_CONCURRENT_QUESTS];
2767 	bool quest_deliver_pos[MAX_CONCURRENT_QUESTS], quest_deliver_xy[MAX_CONCURRENT_QUESTS];
2768 	byte quest_eligible;		/* temporary, just for efficiency */
2769 
2770 #ifdef ENABLE_MAIA
2771 	int voidx; int voidy;		//for the void jumpgate creation spell; reset on every recall/levelchange/relogins
2772 
2773 	int divine_crit;
2774 	int divine_hp;
2775 	int divine_xtra_res_time;
2776 
2777 	int divine_crit_mod;
2778 	int divine_hp_mod;
2779 	int divine_xtra_res_time_mod;
2780 #endif
2781 	bool got_hit;			/* Prevent players from taking it multiple times from a single effect - mikaelh */
2782 	s32b total_damage;		/* No insane amounts of damage either */
2783 	bool quaked;			/* Prevent players from causing more than one earthquake per round via melee attacks - C. Blue */
2784 
2785 #ifdef AUCTION_SYSTEM
2786 	int current_auction;		/* The current auction - mikaelh */
2787 #endif
2788 
2789 	/* ENABLE_STANCES - this code must always be compiled, otherwise savegames would screw up! so no #ifdef here. */
2790 	/* combat stances */
2791 	int combat_stance;		/* 0 = normal, 1 = def, 2 = off */
2792 	int combat_stance_power;	/* 1,2,3, and 4 = royal (for NR balanced) */
2793 
2794 	/* more techniques */
2795 	byte cloaked, cloak_neutralized; /* Cloaking mode enabled; suspicious action was spotted */
2796 	s16b melee_sprint, ranged_double_used;
2797 	bool ranged_flare, ranged_precision, ranged_double, ranged_barrage;
2798 	bool shadow_running;
2799 
2800 #ifdef AUTO_RET_CMD
2801 	int autoret;			/* set auto-retaliation via command instead of inscription */
2802 #endif
2803 	bool shoot_till_kill, shooty_till_kill, shooting_till_kill; /* Shoot a target until it's dead, like a ranged 'auto-retaliator' - C. Blue */
2804 	int shoot_till_kill_book, shoot_till_kill_spell, shoot_till_kill_mimic;
2805 	bool dual_mode; /* for dual-wield: TRUE = dual-mode, FALSE = main-hand-mode */
2806 
2807 	/* Runecraft Info */
2808 	bool shoot_till_kill_rcraft;	/* FTK */
2809 	u16b FTK_e_flags;
2810 	u16b FTK_m_flags;
2811 	u16b FTK_energy;
2812 
2813 	u16b tim_deflect;
2814 
2815 #if defined(DUNGEON_VISIT_BONUS) || defined(ALLOW_NR_CROSS_PARTIES)
2816 	struct worldpos wpos_old;
2817 #endif
2818 
2819 #if 0 /* deprecated */
2820 	/* NOT IMPLEMENTED YET: add spell array for quick access via new method of macroing spells
2821 	   by specifying the spell name instead of a book and position - C. Blue */
2822 	char spell_name[100][20];
2823 	int spell_book[100], spell_pos[100];
2824 #endif
2825 
2826 	bool aura[MAX_AURAS];		/* allow toggling auras for possibly more tactical utilization - C. Blue */
2827 
2828 	/* for C_BLUE_AI, new thingy: Monsters that are able to ignore a "tank" player */
2829 	int heal_turn[20 + 1];		/* records the amount of healing the player received for each of 20 consecutive turns */
2830 	u32b heal_turn_20, heal_turn_10, heal_turn_5;
2831 	int dam_turn[20 + 1];		/* records the amount of damage the player dealt for each of 20 consecutive turns */
2832 	u32b dam_turn_20, dam_turn_10, dam_turn_5;
2833 
2834 	/* for PvP mode: keep track of kills/progress for adding a reward or something - C. Blue */
2835 	int kills, kills_lower, kills_higher, kills_equal, kills_own;
2836 	int free_mimic, pvp_prevent_tele, pvp_prevent_phase;
2837 	long heal_effect;
2838 	bool no_heal;			/* for special events */
2839 
2840 	/* for client-side weather */
2841 	bool panel_changed;
2842 	int custom_weather;		/* used /cw command */
2843 	int joke_weather;		/* personal rain^^ */
2844 	bool no_weather;
2845 
2846 	/* buffer for anti-cheeze system, just to reduce file access to tomenet.acc */
2847 	s32b cheeze_value, cheeze_self_value;
2848 
2849 	int mcharming;			/* for mindcrafters' charming */
2850 	u32b turns_on_floor;		/* number of turns spent on the current floor */
2851 	bool distinct_floor_feeling;	/* set depending on turns_on_floor */
2852 	bool sun_burn;			/* Player is vampire, currently burning in the sun? */
2853 
2854 	/* server-side animation timing flags */
2855 	int invis_phase;		/* for invisible players who flicker towards others */
2856 //not needed!	int colour_phase; /* for mimics mimicking multi-coloured stuff */
2857 
2858 	/* for hunting down bots generating exp by opening and magelocking doors */
2859 	u32b silly_door_exp;
2860 
2861 #if (MAX_PING_RECVS_LOGGED > 0)
2862 	/* list of ping reception times */
2863 	struct timeval pings_received[MAX_PING_RECVS_LOGGED];
2864 	char pings_received_head;
2865 #endif
2866 
2867 	int admin_stasis;		/* allow admins to put a character into 'administrative stasis' */
2868 	/* more admin fooling around (give a 1-hit-kill attack to the player, or let him die in 1 hit) */
2869 	int admin_godly_strike, admin_set_defeat;
2870 	bool admin_invuln, admin_invinc; /* Amulets of Invulnerability/Invincibility */
2871 	char admin_parm[MAX_CHARS];	/* optional special admin command parameter (hacky o_O) */
2872 
2873 	u32b test_count, test_dam, test_heal, test_turn;
2874 #ifdef TEST_SERVER
2875 	u32b test_attacks;
2876 #endif
2877 
2878 	/* give players certain warnings, meant to guide newbies along, and remember
2879 	   if we already gave a specific warning, so we don't spam the player with it
2880 	   again and again - although noone probably reads them anyway ;-p - C. Blue */
2881 	char warning_bpr, warning_bpr2, warning_bpr3;
2882 	char warning_run, warning_run_steps, warning_run_monlos, warning_run_lite;
2883 	char warning_wield, warning_chat, warning_lite, warning_lite_refill;
2884 	char warning_wield_combat; /* warn if engaging into combat (attacking/taking damage) without having equipped melee/ranged weapons! (except for druids) */
2885 	char warning_rest, warning_rest_cooldown;/* if a char rests from <= 40% to 50% without R, or so..*/
2886 	char warning_mimic, warning_dual, warning_dual_mode, warning_potions, warning_wor;
2887 	char warning_ghost, warning_instares, warning_autoret, warning_autoret_ok;
2888 	char warning_ma_weapon, warning_ma_shield;
2889 	char warning_technique_melee, warning_technique_ranged;
2890 	char warning_hungry, warning_autopickup, warning_ranged_autoret;
2891 	/* note: a sort of "warning_skills" is already implemented, in a different manner */
2892 	char warning_cloak, warning_macros, warning_numpadmove;
2893 	char warning_ammotype, warning_ai_annoy;
2894 	char warning_fountain, warning_voidjumpgate, warning_staircase, warning_worldmap, warning_dungeon;
2895 	/* For the 4.4.8.1.0.0 lua update crash bug */
2896 	char warning_lua_update, warning_lua_count;
2897 	char warning_tunnel, warning_tunnel2, warning_trap, warning_tele, warning_fracexp;
2898 	char warning_death;
2899 
2900 #ifdef USE_SOUND_2010
2901 	int music_current, musicalt_current, music_monster; //background music currently playing for him/her; an overriding monster music
2902 	int audio_sfx, audio_mus, music_start;
2903 	int sound_ambient;
2904 	/* added for ambient-sfx-handling, so it does not do smooth transition
2905 	   on every wilderness wpos change even though we used WoR instead of walking: */
2906 	bool is_day;
2907 	int ambient_sfx_timer;		/* hack for running through wilderness too quickly for normal ambient sfx to get played */
2908 #endif
2909 	bool cut_sfx_attack, half_sfx_attack, half_sfx_attack_state;
2910 	int count_cut_sfx_attack;
2911 	bool sfx_combat, sfx_magicattack, sfx_defense, sfx_monsterattack, sfx_shriek, sfx_store, sfx_house_quiet, sfx_house;
2912 
2913 	/* various flags/counters to check if a character is 'freshly made' and/or has already interacted in certain ways.
2914 	   Mostly to test if he/she is eglibile to join events. */
2915 	bool recv_gold, recv_item, bought_item, killed_mon;
2916 
2917 	/* Stuff for new SPECIAL stores and PKT_REQUEST_...;
2918 	   could also be used for quests and neutral monsters. - C. Blue */
2919 	int store_action;		/* What the player is currently doing in a store */
2920 	int request_id, request_type;	/* to keep track of PKT_REQUEST_... requests */
2921 	char go_level, go_sublevel;	/* For playing Go */
2922 
2923 	/* Delayed requests are for quests, to prevent players from spamming password attempts */
2924 	byte delay_str;
2925 	int delay_str_id;
2926 	char delay_str_prompt[MAX_CHARS];
2927 	char delay_str_std[MAX_CHARS];
2928 	byte delay_cfr;
2929 	int delay_cfr_id;
2930 	char delay_cfr_prompt[MAX_CHARS];
2931 	bool delay_cfr_default_yes;
2932 
2933 	char reply_name[MAX_CHARS];	/* last player who sent us a private message, for replying */
2934 
2935 	int piercing;			/* Rogue skill 'assassinate' */
2936 	bool piercing_charged;
2937 
2938 	char last_chat_line[MSG_LEN];	/* last slash command (or chat msg) the player used, to prevent log file spam */
2939 	int last_chat_line_cnt;
2940 	int last_gold_drop, last_gold_drop_timer;
2941 
2942 	u32b party_flags, guild_flags;	/* For things like 'Officer' status to add others etc */
2943 
2944 	/* SEPARATE_RECALL_DEPTHS */
2945 	byte max_depth[MAX_D_IDX * 2], max_depth_wx[MAX_D_IDX * 2], max_depth_wy[MAX_D_IDX * 2]; /* x2 to account for possible wilderness dungeons */
2946 	bool max_depth_tower[MAX_D_IDX * 2];
2947 
2948 	u32b gold_picked_up;		/* for EVENT_TOWNIE_GOLD_LIMIT */
2949 	bool IDDC_found_rndtown;	/* prevent multiple random towns within one 'interval' */
2950 	bool IDDC_logscum;		/* prevent log-scumming instead of proceeding downwards */
2951 	byte IDDC_flags;		/* added for IDDC special hack: Make it easier to find up to two speed rings */
2952 
2953 	bool insta_res;			/* Instant resurrection */
2954 	s16b tmp_x, tmp_y;		/* temporary xtra stuff, can be used by whatever */
2955 	bool font_map_solid_walls;	/* Hack: Certain Windows bitmap fonts: Map walls to /127, solid block tile */
2956 	s16b flash_self;
2957 	bool hilite_player;		/* possible resurrection of long since broken c_cfg.hilite_player: Draw cursor around us at all times. */
2958 	bool consistent_players;	/* Use consistent colouring for player and allies. Ignore all status/body_monster */
2959 #ifdef TELEPORT_SURPRISES
2960 	byte teleported;		/* optional/experimental: in the future, a cooldown for monsters who are 'surprised' from player teleporting next to them */
2961 #endif
2962 
2963 	char redraw_cooldown;		/* prevent people spamming CTRL+R (costs cpu+net) */
2964 	bool auto_insc[INVEN_TOTAL];	/* client-side auto-inscribing helper var */
2965 	bool grid_sunlit, grid_house;	/* vampire handling; ambient sfx handling */
2966 	u16b cards_diamonds, cards_hearts, cards_spades, cards_clubs;	/* for /deal and /shuffle commands */
2967 
2968 	bool exp_bar;			//just for tracking popularity of this feature..
2969 };
2970 
2971 typedef struct boni_col boni_col;
2972 
2973 struct boni_col
2974 {
2975 	/* Index */
2976 	byte i;
2977 	/* Hack signed char/byte values */
2978 	char spd, slth, srch, infr, lite, dig, blow, crit, shot, migh, mxhp, mxmp, luck, pstr, pint, pwis, pdex, pcon, pchr, amfi, sigl;
2979 	/* Flags in char/byte chunks for PKT transfer */
2980 	byte cb[13]; //13 so far, hardcode
2981 	/* Attr + Char */
2982 	char color; char symbol;
2983 };
2984 
2985 /* For Monk martial arts */
2986 
2987 typedef struct martial_arts martial_arts;
2988 
2989 struct martial_arts
2990 {
2991     cptr    desc;    /* A verbose attack description */
2992     int     min_level;  /* Minimum level to use */
2993     int     rchance;     /* Reverse chance, lower value means more often */
2994     int     dd;        /* Damage dice */
2995     int     ds;        /* Damage sides */
2996     int     effect;     /* Special effects */
2997 };
2998 
2999 /* Define monster generation rules */
3000 typedef struct rule_type rule_type;
3001 struct rule_type
3002 {
3003 	byte mode;			/* Mode of combination of the monster flags */
3004 	byte percent;			/* Percentage of monsters added by this rule */
3005 
3006 	u32b mflags1;			/* The monster flags that are allowed */
3007 	u32b mflags2;
3008 	u32b mflags3;
3009 	u32b mflags4;
3010 	u32b mflags5;
3011 	u32b mflags6;
3012 	u32b mflags7;
3013 	u32b mflags8;
3014 	u32b mflags9;
3015 	u32b mflags0;
3016 
3017 	char r_char[5];			/* Monster race allowed */
3018 };
3019 
3020 #ifdef IRONDEEPDIVE_MIXED_TYPES
3021 typedef struct iddc_type iddc_type;
3022 struct iddc_type {
3023 	byte type; //d_info[] index
3024 	byte step; //transition stage
3025 	byte next; //next d_info[] index
3026 };
3027 #endif
3028 
3029 /* A structure for the != dungeon types */
3030 typedef struct dungeon_info_type dungeon_info_type;
3031 struct dungeon_info_type
3032 {
3033 	u32b name;                      /* Name */
3034 //	int idx;			/* index in d_info.txt */
3035 	u32b text;                      /* Description */
3036 	char short_name[3];             /* Short name */
3037 
3038 	s16b feat_boundary;		/* Boundary permanent wall visual */
3039 	s16b floor[5];                    /* Floor tile n */
3040 	s16b floor_percent[5][2];         /* Chance of type n [0]; End chance of type n [1] */
3041 	s16b outer_wall;                /* Outer wall tile */
3042 	s16b inner_wall;                /* Inner wall tile */
3043 	s16b fill_type[5];                /* Cave tile n */
3044 	s16b fill_percent[5][2];          /* Chance of type n [0]; End chance of type n [1] */
3045 	byte fill_method;		/* Smoothing parameter for the above */
3046 
3047 	s16b mindepth;                  /* Minimal depth */
3048 	s16b maxdepth;                  /* Maximal depth */
3049 
3050 	bool principal;                 /* If it's a part of the main dungeon */
3051 	byte next;                      /* The next part of the main dungeon */
3052 	byte min_plev;                  /* Minimal plev needed to enter -- it's an anti-cheating mesure */
3053 
3054 	int min_m_alloc_level;          /* Minimal number of monsters per level */
3055 	int max_m_alloc_chance;         /* There is a 1/max_m_alloc_chance chance per round of creating a new monster */
3056 
3057 	u32b flags1;                    /* Flags 1 */
3058 	u32b flags2;                    /* Flags 2 */
3059 	u32b flags3;                    /* Flags 3 */
3060 
3061 	byte rule_percents[100];        /* Flat rule percents */
3062 	rule_type rules[5];             /* Monster generation rules */
3063 
3064 	int final_object;               /* The object you'll find at the bottom */
3065 	int final_artifact;             /* The artifact you'll find at the bottom */
3066 	int final_guardian;             /* The artifact's guardian. If an artifact is specified, then it's NEEDED */
3067 
3068 	int ix, iy, ox, oy;             /* Wilderness coordinates of the entrance/output of the dungeon */
3069 
3070 	obj_theme objs;                 /* The drops type */
3071 
3072 	int d_dice[4];                  /* Number of dices */
3073 	int d_side[4];                  /* Number of sides */
3074 	int d_frequency[4];             /* Frequency of damage (1 is the minimum) */
3075 	int d_type[4];                  /* Type of damage */
3076 
3077 	s16b t_idx[TOWN_DUNGEON];       /* The towns */
3078 	s16b t_level[TOWN_DUNGEON];     /* The towns levels */
3079 	s16b t_num;                     /* Number of towns */
3080 };
3081 
3082 /*
3083  * Hack -- basic town data
3084  * (In great need of death!)
3085  */
3086 typedef struct town_extra town_extra;
3087 struct town_extra
3088 {
3089 	cptr name;
3090 	byte feat1;
3091 	byte feat2;
3092 	byte ratio;		/* percent of feat1 */
3093 	byte wild_req;	/* On what kind of wilderness this town should be built */
3094 	u16b dungeons[2];	/* Type of dungeon(s) the town contains */
3095 	u16b dun_base;
3096 	u16b dun_max;
3097 	bool tower;		/* TODO: change it, so that a town can have both tower and dungeon */
3098 	u32b flags1;
3099 	u32b flags2;
3100 };
3101 
3102 
3103 /* Server option struct */
3104 
3105 typedef struct server_opts server_opts;
3106 
3107 struct server_opts {
3108 	s16b runlevel;		/* Glorified shutdown mode */
3109 	time_t runtime;		/* Server start time */
3110 	time_t closetime;	/* Server closedown time */
3111 	char *meta_address;
3112 	s16b meta_port;
3113 
3114 	char *bind_name;
3115 	char *console_password;
3116 	char *admin_wizard;
3117 	char *dungeon_master;
3118 	char *wserver;
3119 
3120 	char *pass;
3121 	s32b preserve_death_level;
3122 	s32b unique_respawn_time;
3123 	s32b unique_max_respawn_time;
3124 	s32b level_unstatic_chance;
3125 
3126 	s32b min_unstatic_level;
3127 	s32b retire_timer;
3128 	s32b game_port;
3129 	s32b console_port;
3130 	s32b gw_port;
3131 
3132 	s32b spell_interfere;
3133 	s32b spell_stack_limit;
3134 	s16b fps;
3135 	bool players_never_expire;
3136 	s16b newbies_cannot_drop;
3137 	s16b running_speed;
3138 
3139 	s16b anti_scum;
3140 	s16b dun_unusual;
3141 	s16b town_x;
3142 	s16b town_y;
3143 	s16b town_base;
3144 
3145 	s16b dun_base;
3146 	s16b dun_max;
3147 	s16b store_turns;
3148 	s16b dun_store_turns;
3149 	char resting_rate;
3150 	char party_xp_boost;
3151 
3152 	char use_pk_rules;
3153 	char quit_ban_mode;
3154 	char zang_monsters;
3155 	char pern_monsters;
3156 	char cth_monsters;
3157 
3158 	char joke_monsters;
3159 	char cblue_monsters;
3160 	char vanilla_monsters;
3161 	char pet_monsters;
3162 	bool report_to_meta;
3163 	bool secret_dungeon_master;
3164 
3165 	bool anti_arts_hoard;
3166 	bool anti_arts_house;
3167 	bool anti_arts_wild;
3168 	bool anti_arts_shop;
3169 	bool anti_arts_pickup;
3170 	bool anti_arts_send;
3171 	bool persistent_artifacts;
3172 
3173 	bool anti_cheeze_pickup;
3174 	bool anti_cheeze_telekinesis;
3175 	s16b surface_item_removal; /* minutes before items are erased */
3176 	s16b dungeon_item_removal; /* minutes before items are erased */
3177 	u16b death_wild_item_removal; /* minutes before items are erased */
3178 	u16b long_wild_item_removal; /* minutes before items are erased */
3179 	s16b dungeon_shop_chance;
3180 	s16b dungeon_shop_type;
3181 	s16b dungeon_shop_timeout;
3182 
3183 	bool mage_hp_bonus;	/* DELETEME (replace it, that is) */
3184 	char door_bump_open;
3185 	bool no_ghost;
3186 	int lifes;		/* number of times a ghost player can be resurrected */
3187 	int houses_per_player;	/* number of houses a player is allowed to own at once;
3188 				    it's: max_houses = (player_level / houses_per_player). */
3189 	int castles_per_player; /* absolute # of castles a character may own (0 for infinite) */
3190 	bool castles_for_kings;
3191 	bool maximize;
3192 	bool kings_etiquette;
3193 	bool fallenkings_etiquette;
3194 	bool strict_etiquette;
3195 
3196 	bool public_rfe;
3197 	bool auto_purge;
3198 	bool log_u;
3199 	s16b replace_hiscore;
3200 	s16b unikill_format;
3201 	char *server_notes;
3202 	bool arts_disabled;
3203 	bool winners_find_randarts;
3204 	s16b arts_level_req;
3205 	bool surface_summoning;
3206 	s16b clone_summoning;
3207 	s16b henc_strictness;
3208 	s16b bonus_calc_type;		/* The way hit points are calculated (0 = traditional, 1 = modern) */
3209 	s16b charmode_trading_restrictions; /* how restricted is trading between everlating and non-everlasting players */
3210 	s16b item_awareness;	/* How easily the player becomes aware of unknown items (id scroll/shop/..)-C. Blue */
3211 	bool worldd_pubchat, worldd_privchat, worldd_broadcast, worldd_lvlup, worldd_unideath, worldd_pwin, worldd_pdeath, worldd_pjoin, worldd_pleave, worldd_plist, worldd_events;//worldd_ircchat;
3212 };
3213 
3214 /* Client option struct */
3215 /* Consider separate it into client/types.h and server/types.h */
3216 typedef struct client_opts client_opts;
3217 
3218 struct client_opts {
3219     //page 1
3220 	bool rogue_like_commands;
3221 	bool newbie_hints;
3222 	bool censor_swearing;
3223 	bool hilite_chat;
3224 	bool hibeep_chat;
3225 	bool page_on_privmsg;
3226 	bool page_on_afk_privmsg;
3227 	bool big_map;
3228 	bool font_map_solid_walls;
3229 	bool view_animated_lite;
3230 	bool wall_lighting;
3231 	bool view_lamp_walls;
3232 	bool view_shade_walls;
3233 	bool floor_lighting;
3234 	bool view_lamp_floor;
3235 	bool view_shade_floor;
3236 	bool view_lite_extra;
3237 	bool alert_hitpoint;
3238 	bool alert_mana;
3239 	bool alert_afk_dam;
3240 	bool alert_offpanel_dam;
3241 	bool exp_bar;
3242     //page 2
3243 	bool uniques_alive;
3244 	bool warn_unique_credit;
3245 	bool limit_chat;
3246 	bool no_afk_msg;
3247 	bool overview_startup;
3248 	bool allow_paging;
3249 	bool ring_bell;
3250 	bool linear_stats;
3251 	bool exp_need;
3252 	bool depth_in_feet;
3253 	bool newb_suicide;
3254 	bool show_weights;
3255 	bool time_stamp_chat;
3256 	bool hide_unusable_skills;
3257 	bool short_item_names;
3258 	bool keep_topline;
3259 	bool target_history;
3260 	bool taciturn_messages;
3261 	bool always_show_lists;
3262 	bool no_weather;
3263 	bool player_list;
3264 	bool player_list2;
3265 
3266     //page 3
3267 	bool flash_player;
3268 	bool hilite_player;
3269 	bool consistent_players;
3270 	bool recall_flicker;
3271 	bool no_verify_destroy;
3272 	bool no_verify_sell;
3273 
3274     //page 5
3275 	bool auto_afk;
3276 	bool idle_starve_kick;
3277 	bool safe_float;
3278 	bool safe_macros;
3279 	bool auto_untag;
3280 	bool clear_inscr;
3281 	bool auto_inscribe;
3282 	bool stack_force_notes;
3283 	bool stack_force_costs;
3284 	bool stack_allow_items;
3285 	bool stack_allow_wands;
3286 	bool whole_ammo_stack;
3287 	bool always_repeat;
3288 	bool always_pickup;
3289 	bool use_old_target;
3290 	bool autooff_retaliator;
3291 	bool fail_no_melee;
3292 	bool wide_scroll_margin;
3293 	bool auto_target;
3294 	bool thin_down_flush;
3295 	bool disable_flush;
3296 
3297     //page 6
3298 	bool find_ignore_stairs;
3299 	bool find_ignore_doors;
3300 	bool find_cut;
3301 	bool find_examine;
3302 	bool disturb_move;
3303 	bool disturb_near;
3304 	bool disturb_panel;
3305 	bool disturb_state;
3306 	bool disturb_minor;
3307 	bool disturb_other;
3308 	bool view_perma_grids;
3309 	bool view_torch_grids;
3310 	bool view_reduce_lite;
3311 	bool view_reduce_view;
3312 	bool easy_open;
3313 	bool easy_disarm;
3314 	bool easy_tunnel;
3315 
3316     //page 4
3317 	bool audio_paging;
3318 	bool paging_master_volume;
3319 	bool paging_max_volume;
3320 	bool no_ovl_close_sfx;
3321 	bool ovl_sfx_attack;
3322 	bool no_combat_sfx;
3323 	bool no_magicattack_sfx;
3324 	bool no_defense_sfx;
3325 	bool half_sfx_attack;
3326 	bool cut_sfx_attack;
3327 	bool ovl_sfx_command;
3328 	bool ovl_sfx_misc;
3329 	bool ovl_sfx_mon_attack;
3330 	bool ovl_sfx_mon_spell;
3331 	bool ovl_sfx_mon_misc;
3332 	bool no_monsterattack_sfx;
3333 	bool no_shriek_sfx;
3334 	bool no_store_bell;
3335 	bool quiet_house_sfx;
3336 	bool no_house_sfx;
3337 
3338     //unmutable, pfft
3339 	bool use_color;
3340 	bool other_query_flag;
3341 
3342     //deprecated/broken/todo
3343 #if 0
3344 	bool quick_messages;
3345 	bool carry_query_flag;
3346 	bool show_labels;
3347 	bool show_choices;
3348 	bool show_details;
3349 	bool expand_look;
3350 	bool expand_list;
3351 	bool avoid_other;
3352 	bool flush_failure;
3353 	bool flush_disturb;
3354 	bool fresh_after;
3355 	bool auto_destroy;
3356 	bool last_words;
3357 	bool speak_unique;
3358 
3359 	//additional stuff
3360 	bool auto_scum;
3361 	bool flush_command;
3362 	bool fresh_before;
3363 	bool auto_haggle;
3364 	bool flow_by_sound;
3365 	bool flow_by_smell;
3366 	bool dungeon_stair;
3367 	bool smart_learn;
3368 	bool smart_cheat;
3369 	bool alert_failure;
3370 	bool dungeon_align;
3371 	bool avoid_abort;
3372 	bool compress_savefile;
3373 #endif
3374 };
3375 
3376 /*
3377  * Extra information on client-side that the server player_type
3378  * doesn't contain.		- Jir -
3379  *
3380  * Most variables in client/variable.c should be bandled here maybe.
3381  */
3382 typedef struct c_player_extra c_player_extra;
3383 struct c_player_extra
3384 {
3385 	char body_name[MAX_CHARS];	/* Form of Player */
3386 	char sanity[10];	/* Sanity strings */
3387 	byte sanity_attr;	/* Colour to display sanity */
3388 	char location_name[20];	/* Name of location (eg. 'Bree') */
3389 };
3390 
3391 typedef struct c_store_extra c_store_extra;
3392 struct c_store_extra
3393 {
3394 	char owner_name[40];
3395 	char store_name[40];
3396 	s32b max_cost;			/* Purse limit */
3397 
3398 	/* list of command */
3399 	u16b actions[6];                /* Actions(refers to ba_info) */
3400 	u16b bact[6];                /* ba_ptr->action */
3401 	char action_name[6][40];
3402 	char action_attr[6];
3403 	u16b action_restr[6];
3404 	char letter[6];
3405 	s16b cost[6];
3406 	byte flags[6];
3407 
3408 	/* Store attr and char */
3409 	byte store_attr;
3410 	char store_char;
3411 };
3412 
3413 /* from spells1.c */
3414 typedef int (*inven_func)(object_type *);
3415 
3416 typedef struct hooks_chain hooks_chain;
3417 struct hooks_chain
3418 {
3419 	char name[40];
3420 	char script[40];
3421 	hooks_chain *next;
3422 };
3423 
3424 typedef union hook_return hook_return;
3425 union hook_return
3426 {
3427 	s32b num;
3428 	char *str;
3429 	object_type *o_ptr;
3430 };
3431 
3432 /*
3433  * The spell function must provide the desc
3434  */
3435 typedef struct spell_type spell_type;
3436 struct spell_type
3437 {
3438         cptr name;                      /* Name */
3439         byte skill_level;               /* Required level (to learn) */
3440 	byte mana;			/* Required mana at lvl 1 */
3441 	byte mana_max;			/* Required mana at max lvl */
3442 	byte fail;			/* Minimum chance of failure */
3443         s16b level;                     /* Spell level(0 = not learnt) */
3444         byte spell_power;		/* affected by spell-power skill? */
3445 };
3446 
3447 typedef struct school_type school_type;
3448 struct school_type
3449 {
3450         cptr name;                      /* Name */
3451         s16b skill;                     /* Skill used for that school */
3452 };
3453 
3454 /* C. Blue - don't confuse with xorder_type, which is for the basic kill '/xorder'.
3455    This is more of a global event, first use will be automated Highlander Tournament
3456    schedule. Timing is possible too. Might want to make use of AT_... sequences. */
3457 typedef struct global_event_type global_event_type;
3458 struct global_event_type {
3459     int getype;			/* Type of the event (or quest) */
3460     bool paused;		/* Is the event currently paused? (special admin command) */
3461     s32b paused_turns;		/* Keeps track of turns the event was actually frozen */
3462     s32b state[64];		/* progress (zero'ed on event start) */
3463     s32b extra[64];		/* extra info (zero'ed on event start) */
3464     s32b participant[MAX_GE_PARTICIPANTS];	/* player IDs */
3465     s32b creator;       	/* Player ID or 0L */
3466     long int announcement_time;	/* for how many seconds the event will be announced until it actually starts */
3467     long int signup_time;	/* for how many seconds the event will allow signing up:
3468 				   -1 = this event doesn't allow signing up at all!
3469 				   0 = same as announcement_time, ie during the announcement phase
3470 				   >0 = designated time instead of announcement_time. */
3471     bool first_announcement;	/* just keep track of first advertisement, and add additional info that time */
3472     s32b start_turn;          	/* quest started */
3473     s32b end_turn;		/* quest will end */
3474     time_t started;		/* quest started */
3475     time_t ending;		/* quest will end */
3476     char title[64];		/* short title of this event (used for /gesign <n> player command) */
3477     char description[10][78];	/* longer event description */
3478     bool hidden;		/* hidden from the players? */
3479     int min_participants;	/* minimum amount of participants */
3480     int limited;		/* limited amount of participants? (smaller than MAX_GE_PARTICIPANTS) */
3481     int cleanup;		/* what kind of cleaning-up is required when event ends (state=255) ? */
3482     bool noghost;		/* event will erase character on failure */
3483 };
3484 
3485 /* Runecraft */
3486 typedef struct r_element r_element;
3487 struct r_element
3488 {
3489 	u16b flag;
3490 	char * name;
3491 	u16b skill;
3492 };
3493 typedef struct r_imperative r_imperative;
3494 struct r_imperative
3495 {
3496 	u16b flag;
3497 	char * name;
3498 	byte level;
3499 	byte cost;
3500 	s16b fail;
3501 	byte damage;
3502 	s16b radius;
3503 	byte duration;
3504 	byte energy;
3505 };
3506 typedef struct r_type r_type;
3507 struct r_type
3508 {
3509 	u16b flag;
3510 	char * name;
3511 	byte level;
3512 	byte c_min;
3513 	byte c_max;
3514 	byte d1min;
3515 	byte d2min;
3516 	byte d1max;
3517 	byte d2max;
3518 	byte dbmin;
3519 	u16b dbmax;
3520 	byte r_min;
3521 	byte r_max;
3522 	byte d_min;
3523 	byte d_max;
3524 };
3525 typedef struct r_projection r_projection;
3526 struct r_projection
3527 {
3528 	u16b flags;
3529 	int gf_type;
3530 	int weight;
3531 	char * name;
3532 	u32b resist;
3533 };
3534 
3535 /* Auction system - mikaelh */
3536 typedef struct bid_type bid_type;
3537 struct bid_type
3538 {
3539 	s32b		bid;
3540 	s32b		bidder;
3541 };
3542 
3543 typedef struct auction_type auction_type;
3544 struct auction_type
3545 {
3546 	byte		status;			/* Status: setup, bidding, finished or cancelled */
3547 	byte		flags;			/* Flags: payments */
3548 	byte		mode;			/* Owner mode: Non-everlasting or everlasting */
3549 	s32b		owner;			/* Owner */
3550 	object_type	item;			/* Auctioned item */
3551 	char		*desc;			/* Item description */
3552 	s32b		starting_price;		/* Starting price */
3553 	s32b		buyout_price;		/* Buy-out price */
3554 	s32b		bids_cnt;		/* Number of bids */
3555 	bid_type	*bids;
3556 	s32b		winning_bid;		/* The winning bid (after bidding is over) */
3557 	time_t		start;
3558 	time_t		duration;
3559 };
3560 
3561 #ifdef MONSTER_ASTAR		/* A* path finding - C. Blue */
3562 typedef struct astar_list_open astar_list_open;
3563 struct astar_list_open {
3564 	int m_idx; /* monster which currently uses this index in the available A* arrays, or -1 for 'unused' ie available */
3565 	int nodes; /* current amount of nodes stored in this list */
3566 	int node_x[ASTAR_MAX_NODES], node_y[ASTAR_MAX_NODES]; /* unsigned char would do, but maybe we want to stop using that one for floor grids (compiler warnings in other files too, etc..) */
3567 	int astarF[ASTAR_MAX_NODES], astarG[ASTAR_MAX_NODES], astarH[ASTAR_MAX_NODES]; /* grid score (F=G+H), starting point distance cost, estimated goal distance cost */
3568 	int closed_parent_idx[ASTAR_MAX_NODES]; /* the idx of the grid in the closed list, which is the parent of this grid */
3569 };
3570 typedef struct astar_list_closed astar_list_closed;
3571 struct astar_list_closed {
3572 	int nodes; /* current amount of nodes stored in this list */
3573 	int node_x[ASTAR_MAX_NODES], node_y[ASTAR_MAX_NODES]; /* unsigned char would do, but maybe we want to stop using that one for floor grids (compiler warnings in other files too, etc..) */
3574 	int closed_parent_idx[ASTAR_MAX_NODES]; /* the idx of the grid in the closed list, which is the parent of this grid */
3575 };
3576 #endif
3577 
3578 #ifdef USE_SOUND_2010
3579 //main.h: (from angband)
3580 struct module {
3581 	cptr name;
3582 	cptr help;
3583 	errr (*init)(int argc, char **argv);
3584 };
3585 #endif
3586 
3587 /* for (currently hardcoded client-side) mimic spells, to enable proper targetting */
3588 typedef struct monster_spell_type {
3589 	cptr name;
3590 	bool uses_dir; /* flag */
3591 } monster_spell_type;
3592 
3593 
3594 /* The struct to hold a data entry */
3595 typedef struct hash_entry hash_entry;
3596 struct hash_entry {
3597 	int id;				/* The character ID */
3598 	u32b account;			/* account id */
3599 	cptr accountname;		/* NOTE: this value is NOT loaded/saved but fetched live on each server startup */
3600 	cptr name;			/* Player name */
3601 	byte race,class;		/* Race/class */
3602 	byte admin;
3603 	struct worldpos wpos;
3604 
3605 	/* new in savegame version 4.2.2 (4.2.0c server) - C. Blue */
3606 	byte mode;			/* Character mode (for account overview screen) */
3607 
3608 	/* new in 3.4.2 */
3609 	byte level;			/* Player maximum level */
3610 	/* changed from byte to u16b - mikaelh */
3611 	u16b party;			/* Player party */
3612 	/* 3.5.0 */
3613 	byte guild;			/* Player guild */
3614 	u32b guild_flags;		/* 4.5.2.0.0.1 */
3615 	s16b xorder;			/* Extermination order */
3616 
3617 	time_t laston;			/* Last on time */
3618 
3619 #ifdef AUCTION_SYSTEM
3620 	s32b au;
3621 	s32b balance;
3622 #endif
3623 
3624 	struct hash_entry *next;	/* Next entry in the chain */
3625 };
3626