|
|
1.1 root 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 are permitted
6: * provided that: (1) source distributions retain this entire copyright
7: * notice and comment, and (2) distributions including binaries display
8: * the following acknowledgement: ``This product includes software
9: * developed by the University of California, Berkeley and its contributors''
10: * in the documentation or other materials provided with the distribution
11: * and in all advertising materials mentioning features or use of this
12: * software. Neither the name of the University nor the names of its
13: * contributors may be used to endorse or promote products derived
14: * from this software without specific prior written permission.
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: *
19: * @(#)monop.h 5.5 (Berkeley) 6/1/90
20: */
21:
22: # include <stdio.h>
23:
24: # define reg register
25: # define shrt char
26: # define bool char
27: # define unsgn unsigned
28:
29: # define TRUE (1)
30: # define FALSE (0)
31:
32: # define N_MON 8 /* number of monopolies */
33: # define N_PROP 22 /* number of normal property squares */
34: # define N_RR 4 /* number of railroads */
35: # define N_UTIL 2 /* number of utilities */
36: # define N_SQRS 40 /* number of squares on board */
37: # define MAX_PL 9 /* maximum number of players */
38: # define MAX_PRP (N_PROP+N_RR+N_UTIL) /* max # ownable property */
39:
40: /* square type numbers */
41: # define PRPTY 0 /* normal property */
42: # define RR 1 /* railroad */
43: # define UTIL 2 /* water works - electric co */
44: # define SAFE 3 /* safe spot */
45: # define CC 4 /* community chest */
46: # define CHANCE 5 /* chance (surprise!!!) */
47: # define INC_TAX 6 /* Income tax */
48: # define GOTO_J 7 /* Go To Jail! */
49: # define LUX_TAX 8 /* Luxury tax */
50: # define IN_JAIL 9 /* In jail */
51:
52: # define JAIL 40 /* JAIL square number */
53:
54: # define lucky(str) printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1])
55: # define printline() printf("------------------------------\n")
56: # define sqnum(sqp) (sqp - board)
57: # define swap(A1,A2) if ((A1) != (A2)) { \
58: (A1) ^= (A2); \
59: (A2) ^= (A1); \
60: (A1) ^= (A2); \
61: }
62:
63: struct sqr_st { /* structure for square */
64: char *name; /* place name */
65: shrt owner; /* owner number */
66: shrt type; /* place type */
67: struct prp_st *desc; /* description struct */
68: int cost; /* cost */
69: };
70:
71: typedef struct sqr_st SQUARE;
72:
73: struct mon_st { /* monopoly description structure */
74: char *name; /* monop. name (color) */
75: shrt owner; /* owner of monopoly */
76: shrt num_in; /* # in monopoly */
77: shrt num_own; /* # owned (-1: not poss. monop)*/
78: shrt h_cost; /* price of houses */
79: char *not_m; /* name if not monopoly */
80: char *mon_n; /* name if a monopoly */
81: char sqnums[3]; /* Square numbers (used to init)*/
82: SQUARE *sq[3]; /* list of squares in monop */
83: };
84:
85: typedef struct mon_st MON;
86:
87: /*
88: * This struct describes a property. For railroads and utilities, only
89: * the "morg" member is used.
90: */
91: struct prp_st { /* property description structure */
92: bool morg; /* set if mortgaged */
93: bool monop; /* set if monopoly */
94: shrt square; /* square description */
95: shrt houses; /* number of houses */
96: MON *mon_desc; /* name of color */
97: int rent[6]; /* rents */
98: };
99:
100: struct own_st { /* element in list owned things */
101: SQUARE *sqr; /* pointer to square */
102: struct own_st *next; /* next in list */
103: };
104:
105: typedef struct own_st OWN;
106:
107: struct plr_st { /* player description structure */
108: char *name; /* owner name */
109: shrt num_gojf; /* # of get-out-of-jail-free's */
110: shrt num_rr; /* # of railroads owned */
111: shrt num_util; /* # of water works/elec. co. */
112: shrt loc; /* location on board */
113: shrt in_jail; /* count of turns in jail */
114: int money; /* amount of money */
115: OWN *own_list; /* start of propery list */
116: };
117:
118: typedef struct plr_st PLAY;
119: typedef struct prp_st PROP;
120: typedef struct prp_st RR_S;
121: typedef struct prp_st UTIL_S;
122:
123: int cc(), chance(), lux_tax(), goto_jail(), inc_tax();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.