xref: /original-bsd/games/monop/monop.h (revision f7b3bed6)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)monop.h	5.5 (Berkeley) 06/01/90
8  */
9 
10 # include	<stdio.h>
11 
12 # define	reg	register
13 # define	shrt	char
14 # define	bool	char
15 # define	unsgn	unsigned
16 
17 # define	TRUE	(1)
18 # define	FALSE	(0)
19 
20 # define	N_MON	8	/* number of monopolies			*/
21 # define	N_PROP	22	/* number of normal property squares	*/
22 # define	N_RR	4	/* number of railroads			*/
23 # define	N_UTIL	2	/* number of utilities			*/
24 # define	N_SQRS	40	/* number of squares on board		*/
25 # define	MAX_PL	9	/* maximum number of players		*/
26 # define	MAX_PRP	(N_PROP+N_RR+N_UTIL) /* max # ownable property	*/
27 
28 				/* square type numbers			*/
29 # define	PRPTY	0	/* normal property			*/
30 # define	RR	1	/* railroad				*/
31 # define	UTIL	2	/* water works - electric co		*/
32 # define	SAFE	3	/* safe spot				*/
33 # define	CC	4	/* community chest			*/
34 # define	CHANCE	5	/* chance (surprise!!!)			*/
35 # define	INC_TAX	6	/* Income tax */
36 # define	GOTO_J	7	/* Go To Jail! */
37 # define	LUX_TAX	8	/* Luxury tax */
38 # define	IN_JAIL	9	/* In jail */
39 
40 # define	JAIL	40	/* JAIL square number			*/
41 
42 # define	lucky(str)	printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1])
43 # define	printline()	printf("------------------------------\n")
44 # define	sqnum(sqp)	(sqp - board)
45 # define	swap(A1,A2)	if ((A1) != (A2)) { \
46 					(A1) ^= (A2); \
47 					(A2) ^= (A1); \
48 					(A1) ^= (A2); \
49 				}
50 
51 struct sqr_st {			/* structure for square			*/
52 	char	*name;			/* place name			*/
53 	shrt	owner;			/* owner number			*/
54 	shrt	type;			/* place type			*/
55 	struct prp_st	*desc;		/* description struct		*/
56 	int	cost;			/* cost				*/
57 };
58 
59 typedef struct sqr_st	SQUARE;
60 
61 struct mon_st {			/* monopoly description structure	*/
62 	char	*name;			/* monop. name (color)		*/
63 	shrt	owner;			/* owner of monopoly		*/
64 	shrt	num_in;			/* # in monopoly		*/
65 	shrt	num_own;		/* # owned (-1: not poss. monop)*/
66 	shrt	h_cost;			/* price of houses		*/
67 	char	*not_m;			/* name if not monopoly		*/
68 	char	*mon_n;			/* name if a monopoly		*/
69 	char	sqnums[3];		/* Square numbers (used to init)*/
70 	SQUARE	*sq[3];			/* list of squares in monop	*/
71 };
72 
73 typedef struct mon_st	MON;
74 
75 /*
76  * This struct describes a property.  For railroads and utilities, only
77  * the "morg" member is used.
78  */
79 struct prp_st {			/* property description structure	*/
80 	bool	morg;			/* set if mortgaged		*/
81 	bool	monop;			/* set if monopoly		*/
82 	shrt	square;			/* square description		*/
83 	shrt	houses;			/* number of houses		*/
84 	MON	*mon_desc;		/* name of color		*/
85 	int	rent[6];		/* rents			*/
86 };
87 
88 struct own_st {			/* element in list owned things		*/
89 	SQUARE	*sqr;			/* pointer to square		*/
90 	struct own_st	*next;		/* next in list			*/
91 };
92 
93 typedef struct own_st	OWN;
94 
95 struct plr_st {			/* player description structure		*/
96 	char	*name;			/* owner name			*/
97 	shrt	num_gojf;		/* # of get-out-of-jail-free's	*/
98 	shrt	num_rr;			/* # of railroads owned		*/
99 	shrt	num_util;		/* # of water works/elec. co.	*/
100 	shrt	loc;			/* location on board		*/
101 	shrt	in_jail;		/* count of turns in jail	*/
102 	int	money;			/* amount of money		*/
103 	OWN	*own_list;		/* start of propery list	*/
104 };
105 
106 typedef struct plr_st	PLAY;
107 typedef struct prp_st	PROP;
108 typedef struct prp_st	RR_S;
109 typedef struct prp_st	UTIL_S;
110 
111 int	cc(), chance(), lux_tax(), goto_jail(), inc_tax();
112