1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34: #include <err.h>
35: #include <stdio.h>
36: #include <stdlib.h>
37: #include <string.h>
38:
39: #define bool char
40:
41: #define TRUE (1)
42: #define FALSE (0)
43:
44: #define N_MON 8
45: #define N_PROP 22
46: #define N_RR 4
47: #define N_UTIL 2
48: #define N_SQRS 40
49: #define MAX_PL 9
50: #define MAX_PRP (N_PROP+N_RR+N_UTIL)
51:
52:
53: #define PRPTY 0
54: #define RR 1
55: #define UTIL 2
56: #define SAFE 3
57: #define CC 4
58: #define CHANCE 5
59: #define INC_TAX 6
60: #define GOTO_J 7
61: #define LUX_TAX 8
62: #define IN_JAIL 9
63:
64: #define JAIL 40
65:
66: #define lucky(str) printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1])
67: #define printline() printf("------------------------------\n")
68: #define sqnum(sqp) (sqp - board)
69: #define swap(A1,A2) if ((A1) != (A2)) { \
70: (A1) ^= (A2); \
71: (A2) ^= (A1); \
72: (A1) ^= (A2); \
73: }
74:
75: struct sqr_st {
76: const char *name;
77: short owner;
78: short type;
79: struct prp_st *desc;
80: int cost;
81: };
82:
83: typedef struct sqr_st SQUARE;
84:
85: struct mon_st {
86: const char *name;
87: short owner;
88: short num_in;
89: short num_own;
90: short h_cost;
91: const char *not_m;
92: const char *mon_n;
93: unsigned char sqnums[3];
94: SQUARE *sq[3];
95: };
96:
97: typedef struct mon_st MON;
98:
99:
100:
101:
102:
103: struct prp_st {
104: bool morg;
105: bool monop;
106: short square;
107: short houses;
108: MON *mon_desc;
109: int rent[6];
110: };
111:
112: struct own_st {
113: SQUARE *sqr;
114: struct own_st *next;
115: };
116:
117: typedef struct own_st OWN;
118:
119: struct plr_st {
120: char *name;
121: short num_gojf;
122: short num_rr;
123: short num_util;
124: short loc;
125: short in_jail;
126: int money;
127: OWN *own_list;
128: };
129:
130: typedef struct plr_st PLAY;
131: typedef struct prp_st PROP;
132: typedef struct prp_st RR_S;
133: typedef struct prp_st UTIL_S;
134:
135:
136:
137: void init_decks(void);
138: void get_card(DECK *);
139:
140:
141: void execute(int);
142: void do_move(void);
143: void move(int);
144: void save(void);
145: void restore(void);
146: int rest_f(const char *);
147:
148:
149: int getinp(const char *, const char *const []);
150:
151:
152: void buy_houses(void);
153: void sell_houses(void);
154:
155:
156: void card(void);
157: void ret_card(PLAY *);
158: void pay(void);
159: int move_jail(int, int );
160: void printturn(void);
161:
162:
163: int getyn(const char *);
164: void notify(void);
165: void next_play(void);
166: int get_int(const char *);
167: void set_ownlist(int);
168: void is_monop(MON *, int);
169: void is_not_monop(MON *);
170: void list(void);
171: void list_all(void);
172: void quit(void);
173:
174:
175: void mortgage(void);
176: void unmortgage(void);
177: void force_morg(void);
178:
179:
180: void printboard(void);
181: void where(void);
182: void printsq(int, bool);
183: void printhold(int);
184:
185:
186: void buy(int, SQUARE *);
187: void add_list(int, OWN **, int);
188: void del_list(int, OWN **, short);
189: void bid(void);
190: int prop_worth(PLAY *);
191:
192:
193: void rent(SQUARE *);
194:
195:
196: int roll(int, int);
197:
198:
199: void inc_tax(void);
200: void goto_jail(void);
201: void lux_tax(void);
202: void cc(void);
203: void chance(void);
204:
205:
206: void trade(void);
207: void resign(void);