Commit | Line | Data |
---|---|---|
a526c416 WJ |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
13 | * 3. All advertising materials mentioning features or use of this software | |
14 | * must display the following acknowledgement: | |
15 | * This product includes software developed by the University of | |
16 | * California, Berkeley and its contributors. | |
17 | * 4. Neither the name of the University nor the names of its contributors | |
18 | * may be used to endorse or promote products derived from this software | |
19 | * without specific prior written permission. | |
20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
31 | * SUCH DAMAGE. | |
32 | * | |
33 | * @(#)monop.h 5.5 (Berkeley) 6/1/90 | |
34 | */ | |
35 | ||
36 | # include <stdio.h> | |
37 | ||
38 | # define reg register | |
39 | # define shrt char | |
40 | # define bool char | |
41 | # define unsgn unsigned | |
42 | ||
43 | # define TRUE (1) | |
44 | # define FALSE (0) | |
45 | ||
46 | # define N_MON 8 /* number of monopolies */ | |
47 | # define N_PROP 22 /* number of normal property squares */ | |
48 | # define N_RR 4 /* number of railroads */ | |
49 | # define N_UTIL 2 /* number of utilities */ | |
50 | # define N_SQRS 40 /* number of squares on board */ | |
51 | # define MAX_PL 9 /* maximum number of players */ | |
52 | # define MAX_PRP (N_PROP+N_RR+N_UTIL) /* max # ownable property */ | |
53 | ||
54 | /* square type numbers */ | |
55 | # define PRPTY 0 /* normal property */ | |
56 | # define RR 1 /* railroad */ | |
57 | # define UTIL 2 /* water works - electric co */ | |
58 | # define SAFE 3 /* safe spot */ | |
59 | # define CC 4 /* community chest */ | |
60 | # define CHANCE 5 /* chance (surprise!!!) */ | |
61 | # define INC_TAX 6 /* Income tax */ | |
62 | # define GOTO_J 7 /* Go To Jail! */ | |
63 | # define LUX_TAX 8 /* Luxury tax */ | |
64 | # define IN_JAIL 9 /* In jail */ | |
65 | ||
66 | # define JAIL 40 /* JAIL square number */ | |
67 | ||
68 | # define lucky(str) printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1]) | |
69 | # define printline() printf("------------------------------\n") | |
70 | # define sqnum(sqp) (sqp - board) | |
71 | # define swap(A1,A2) if ((A1) != (A2)) { \ | |
72 | (A1) ^= (A2); \ | |
73 | (A2) ^= (A1); \ | |
74 | (A1) ^= (A2); \ | |
75 | } | |
76 | ||
77 | struct sqr_st { /* structure for square */ | |
78 | char *name; /* place name */ | |
79 | shrt owner; /* owner number */ | |
80 | shrt type; /* place type */ | |
81 | struct prp_st *desc; /* description struct */ | |
82 | int cost; /* cost */ | |
83 | }; | |
84 | ||
85 | typedef struct sqr_st SQUARE; | |
86 | ||
87 | struct mon_st { /* monopoly description structure */ | |
88 | char *name; /* monop. name (color) */ | |
89 | shrt owner; /* owner of monopoly */ | |
90 | shrt num_in; /* # in monopoly */ | |
91 | shrt num_own; /* # owned (-1: not poss. monop)*/ | |
92 | shrt h_cost; /* price of houses */ | |
93 | char *not_m; /* name if not monopoly */ | |
94 | char *mon_n; /* name if a monopoly */ | |
95 | char sqnums[3]; /* Square numbers (used to init)*/ | |
96 | SQUARE *sq[3]; /* list of squares in monop */ | |
97 | }; | |
98 | ||
99 | typedef struct mon_st MON; | |
100 | ||
101 | /* | |
102 | * This struct describes a property. For railroads and utilities, only | |
103 | * the "morg" member is used. | |
104 | */ | |
105 | struct prp_st { /* property description structure */ | |
106 | bool morg; /* set if mortgaged */ | |
107 | bool monop; /* set if monopoly */ | |
108 | shrt square; /* square description */ | |
109 | shrt houses; /* number of houses */ | |
110 | MON *mon_desc; /* name of color */ | |
111 | int rent[6]; /* rents */ | |
112 | }; | |
113 | ||
114 | struct own_st { /* element in list owned things */ | |
115 | SQUARE *sqr; /* pointer to square */ | |
116 | struct own_st *next; /* next in list */ | |
117 | }; | |
118 | ||
119 | typedef struct own_st OWN; | |
120 | ||
121 | struct plr_st { /* player description structure */ | |
122 | char *name; /* owner name */ | |
123 | shrt num_gojf; /* # of get-out-of-jail-free's */ | |
124 | shrt num_rr; /* # of railroads owned */ | |
125 | shrt num_util; /* # of water works/elec. co. */ | |
126 | shrt loc; /* location on board */ | |
127 | shrt in_jail; /* count of turns in jail */ | |
128 | int money; /* amount of money */ | |
129 | OWN *own_list; /* start of propery list */ | |
130 | }; | |
131 | ||
132 | typedef struct plr_st PLAY; | |
133 | typedef struct prp_st PROP; | |
134 | typedef struct prp_st RR_S; | |
135 | typedef struct prp_st UTIL_S; | |
136 | ||
137 | int cc(), chance(), lux_tax(), goto_jail(), inc_tax(); |