date and time created 88/01/02 20:53:32 by bostic
[unix-history] / usr / src / games / monop / monop.h
CommitLineData
ebd7afc8
KB
1/*
2 * Copyright (c) 1987 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of California at Berkeley. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
11 *
12 * @(#)monop.h 5.1 (Berkeley) %G%
13 */
14
15# include <stdio.h>
16
17# define reg register
18# define shrt char
19# define bool char
20# define unsgn unsigned
21
22# define TRUE (1)
23# define FALSE (0)
24
25# define N_MON 8 /* number of monopolies */
26# define N_PROP 22 /* number of normal property squares */
27# define N_RR 4 /* number of railroads */
28# define N_UTIL 2 /* number of utilities */
29# define N_SQRS 40 /* number of squares on board */
30# define MAX_PL 9 /* maximum number of players */
31# define MAX_PRP (N_PROP+N_RR+N_UTIL) /* max # ownable property */
32
33 /* square type numbers */
34# define PRPTY 0 /* normal property */
35# define RR 1 /* railroad */
36# define UTIL 2 /* water works - electric co */
37# define SAFE 3 /* safe spot */
38# define CC 4 /* community chest */
39# define CHANCE 5 /* chance (surprise!!!) */
40# define SPEC 6 /* special */
41
42# define JAIL 40 /* JAIL square number */
43
44# define lucky(str) printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1])
45# define printline() printf("------------------------------\n")
46# define sqnum(sqp) (sqp - board)
47# define swap(A1,A2) if ((A1) != (A2)) { \
48 (A1) ^= (A2); \
49 (A2) ^= (A1); \
50 (A1) ^= (A2); \
51 }
52
53struct sqr_st { /* structure for square */
54 char *name; /* place name */
55 shrt owner; /* owner number */
56 shrt type; /* place type */
57 char *desc; /* description struct */
58 int cost; /* cost */
59};
60
61typedef struct sqr_st SQUARE;
62
63struct mon_st { /* monopoly descriptin structure */
64 char *name; /* monop. name (color) */
65 shrt owner; /* owner of monopoly */
66 shrt num_in; /* # in monopoly */
67 shrt num_own; /* # owned (-1: not poss. monop)*/
68 shrt h_cost; /* price of houses */
69 char *not_m; /* name if not monopoly */
70 char *mon_n; /* name if a monopoly */
71 SQUARE *sq[3]; /* list of squares in monop */
72};
73
74typedef struct mon_st MON;
75
76struct prp_st { /* property description structure */
77 bool morg; /* set if mortgaged */
78 bool monop; /* set if monopoly */
79 shrt square; /* square description */
80 shrt houses; /* number of houses */
81 MON *mon_desc; /* name of color */
82 int rent[6]; /* rents */
83};
84
85struct own_st { /* element in list owned things */
86 SQUARE *sqr; /* pointer to square */
87 struct own_st *next; /* next in list */
88};
89
90typedef struct own_st OWN;
91
92struct plr_st { /* player description structure */
93 char *name; /* owner name */
94 shrt num_gojf; /* # of get-out-of-jail-free's */
95 shrt num_rr; /* # of railroads owned */
96 shrt num_util; /* # of water works/elec. co. */
97 shrt loc; /* location on board */
98 shrt in_jail; /* count of turns in jail */
99 int money; /* amount of money */
100 OWN *own_list; /* start of propery list */
101};
102
103struct rr_st { /* railroad description structure */
104 bool morg; /* set if morgaged */
105};
106
107typedef struct plr_st PLAY;
108typedef struct prp_st PROP;
109typedef struct rr_st RR_S;
110typedef struct rr_st UTIL_S;
111
112int cc(), chance(), lux_tax(), goto_jail(), inc_tax();