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