Commit | Line | Data |
---|---|---|
5244a77d C |
1 | # include <stdio.h> |
2 | ||
3 | # define reg register | |
4 | # define shrt char | |
5 | # define bool char | |
6 | # define unsgn unsigned | |
7 | ||
8 | # define TRUE (1) | |
9 | # define FALSE (0) | |
10 | ||
11 | # define N_MON 8 /* number of monopolies */ | |
12 | # define N_PROP 22 /* number of normal property squares */ | |
13 | # define N_RR 4 /* number of railroads */ | |
14 | # define N_UTIL 2 /* number of utilities */ | |
15 | # define N_SQRS 40 /* number of squares on board */ | |
16 | # define MAX_PL 9 /* maximum number of players */ | |
17 | # define MAX_PRP (N_PROP+N_RR+N_UTIL) /* max # ownable property */ | |
18 | ||
19 | /* square type numbers */ | |
20 | # define PRPTY 0 /* normal property */ | |
21 | # define RR 1 /* railroad */ | |
22 | # define UTIL 2 /* water works - electric co */ | |
23 | # define SAFE 3 /* safe spot */ | |
24 | # define CC 4 /* community chest */ | |
25 | # define CHANCE 5 /* chance (surprise!!!) */ | |
26 | # define SPEC 6 /* special */ | |
27 | ||
28 | # define JAIL 40 /* JAIL square number */ | |
29 | ||
30 | # define lucky(str) printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1]) | |
31 | # define printline() printf("------------------------------\n") | |
32 | # define sqnum(sqp) (sqp - board) | |
33 | # define swap(A1,A2) if ((A1) != (A2)) { \ | |
34 | (A1) ^= (A2); \ | |
35 | (A2) ^= (A1); \ | |
36 | (A1) ^= (A2); \ | |
37 | } | |
38 | ||
39 | struct sqr_st { /* structure for square */ | |
40 | char *name; /* place name */ | |
41 | shrt owner; /* owner number */ | |
42 | shrt type; /* place type */ | |
43 | char *desc; /* description struct */ | |
44 | int cost; /* cost */ | |
45 | }; | |
46 | ||
47 | typedef struct sqr_st SQUARE; | |
48 | ||
49 | struct mon_st { /* monopoly descriptin structure */ | |
50 | char *name; /* monop. name (color) */ | |
51 | shrt owner; /* owner of monopoly */ | |
52 | shrt num_in; /* # in monopoly */ | |
53 | shrt num_own; /* # owned (-1: not poss. monop)*/ | |
54 | shrt h_cost; /* price of houses */ | |
55 | char *not_m; /* name if not monopoly */ | |
56 | char *mon_n; /* name if a monopoly */ | |
57 | SQUARE *sq[3]; /* list of squares in monop */ | |
58 | }; | |
59 | ||
60 | typedef struct mon_st MON; | |
61 | ||
62 | struct prp_st { /* property description structure */ | |
63 | bool morg; /* set if mortgaged */ | |
64 | bool monop; /* set if monopoly */ | |
65 | shrt square; /* square description */ | |
66 | shrt houses; /* number of houses */ | |
67 | MON *mon_desc; /* name of color */ | |
68 | int rent[6]; /* rents */ | |
69 | }; | |
70 | ||
71 | struct own_st { /* element in list owned things */ | |
72 | SQUARE *sqr; /* pointer to square */ | |
73 | struct own_st *next; /* next in list */ | |
74 | }; | |
75 | ||
76 | typedef struct own_st OWN; | |
77 | ||
78 | struct plr_st { /* player description structure */ | |
79 | char *name; /* owner name */ | |
80 | shrt num_gojf; /* # of get-out-of-jail-free's */ | |
81 | shrt num_rr; /* # of railroads owned */ | |
82 | shrt num_util; /* # of water works/elec. co. */ | |
83 | shrt loc; /* location on board */ | |
84 | shrt in_jail; /* count of turns in jail */ | |
85 | int money; /* amount of money */ | |
86 | OWN *own_list; /* start of propery list */ | |
87 | }; | |
88 | ||
89 | struct rr_st { /* railroad description structure */ | |
90 | bool morg; /* set if morgaged */ | |
91 | }; | |
92 | ||
93 | typedef struct plr_st PLAY; | |
94 | typedef struct prp_st PROP; | |
95 | typedef struct rr_st RR_S; | |
96 | typedef struct rr_st UTIL_S; | |
97 | ||
98 | int cc(), chance(), lux_tax(), goto_jail(), inc_tax(); |