Commit | Line | Data |
---|---|---|
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 | * | |
2eb4ff88 | 12 | * @(#)monop.h 5.3 (Berkeley) %G% |
ebd7afc8 KB |
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!!!) */ | |
2497392a KB |
40 | # define INC_TAX 6 /* Income tax */ |
41 | # define GOTO_J 7 /* Go To Jail! */ | |
42 | # define LUX_TAX 8 /* Luxury tax */ | |
43 | # define IN_JAIL 9 /* In jail */ | |
ebd7afc8 KB |
44 | |
45 | # define JAIL 40 /* JAIL square number */ | |
46 | ||
47 | # define lucky(str) printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1]) | |
48 | # define printline() printf("------------------------------\n") | |
49 | # define sqnum(sqp) (sqp - board) | |
50 | # define swap(A1,A2) if ((A1) != (A2)) { \ | |
51 | (A1) ^= (A2); \ | |
52 | (A2) ^= (A1); \ | |
53 | (A1) ^= (A2); \ | |
54 | } | |
55 | ||
56 | struct sqr_st { /* structure for square */ | |
57 | char *name; /* place name */ | |
58 | shrt owner; /* owner number */ | |
59 | shrt type; /* place type */ | |
2497392a | 60 | struct prp_st *desc; /* description struct */ |
ebd7afc8 KB |
61 | int cost; /* cost */ |
62 | }; | |
63 | ||
64 | typedef struct sqr_st SQUARE; | |
65 | ||
2eb4ff88 | 66 | struct mon_st { /* monopoly description structure */ |
ebd7afc8 KB |
67 | char *name; /* monop. name (color) */ |
68 | shrt owner; /* owner of monopoly */ | |
69 | shrt num_in; /* # in monopoly */ | |
70 | shrt num_own; /* # owned (-1: not poss. monop)*/ | |
71 | shrt h_cost; /* price of houses */ | |
72 | char *not_m; /* name if not monopoly */ | |
73 | char *mon_n; /* name if a monopoly */ | |
2eb4ff88 | 74 | char sqnums[3]; /* Square numbers (used to init)*/ |
ebd7afc8 KB |
75 | SQUARE *sq[3]; /* list of squares in monop */ |
76 | }; | |
77 | ||
78 | typedef struct mon_st MON; | |
79 | ||
2497392a KB |
80 | /* |
81 | * This struct describes a property. For railroads and utilities, only | |
82 | * the "morg" member is used. | |
83 | */ | |
ebd7afc8 KB |
84 | struct prp_st { /* property description structure */ |
85 | bool morg; /* set if mortgaged */ | |
86 | bool monop; /* set if monopoly */ | |
87 | shrt square; /* square description */ | |
88 | shrt houses; /* number of houses */ | |
89 | MON *mon_desc; /* name of color */ | |
90 | int rent[6]; /* rents */ | |
91 | }; | |
92 | ||
93 | struct own_st { /* element in list owned things */ | |
94 | SQUARE *sqr; /* pointer to square */ | |
95 | struct own_st *next; /* next in list */ | |
96 | }; | |
97 | ||
98 | typedef struct own_st OWN; | |
99 | ||
100 | struct plr_st { /* player description structure */ | |
101 | char *name; /* owner name */ | |
102 | shrt num_gojf; /* # of get-out-of-jail-free's */ | |
103 | shrt num_rr; /* # of railroads owned */ | |
104 | shrt num_util; /* # of water works/elec. co. */ | |
105 | shrt loc; /* location on board */ | |
106 | shrt in_jail; /* count of turns in jail */ | |
107 | int money; /* amount of money */ | |
108 | OWN *own_list; /* start of propery list */ | |
109 | }; | |
110 | ||
ebd7afc8 KB |
111 | typedef struct plr_st PLAY; |
112 | typedef struct prp_st PROP; | |
2497392a KB |
113 | typedef struct prp_st RR_S; |
114 | typedef struct prp_st UTIL_S; | |
ebd7afc8 KB |
115 | |
116 | int cc(), chance(), lux_tax(), goto_jail(), inc_tax(); |