Remove building with NOCRYPTO option
[minix3.git] / games / monop / monop.h
blobecc74204d2e02ef5a340612438d9fe7cadbd755f
1 /* $NetBSD: monop.h,v 1.19 2009/08/12 08:10:49 dholland Exp $ */
3 /*
4 * Copyright (c) 1980, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
31 * @(#)monop.h 8.1 (Berkeley) 5/31/93
34 #include <err.h>
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <string.h>
39 #define bool char
41 #define TRUE (1)
42 #define FALSE (0)
44 #define N_MON 8 /* number of monopolies */
45 #define N_PROP 22 /* number of normal property squares */
46 #define N_RR 4 /* number of railroads */
47 #define N_UTIL 2 /* number of utilities */
48 #define N_SQRS 40 /* number of squares on board */
49 #define MAX_PL 9 /* maximum number of players */
50 #define MAX_PRP (N_PROP+N_RR+N_UTIL) /* max # ownable property */
51 #define N_HOUSE 32 /* total number of houses available */
52 #define N_HOTEL 12 /* total number of hotels available */
54 /* square type numbers */
55 #define PRPTY 0 /* normal property */
56 #define RR 1 /* railroad */
57 #define UTIL 2 /* water works - electric co */
58 #define SAFE 3 /* safe spot */
59 #define CC 4 /* community chest */
60 #define CHANCE 5 /* chance (surprise!!!) */
61 #define INC_TAX 6 /* Income tax */
62 #define GOTO_J 7 /* Go To Jail! */
63 #define LUX_TAX 8 /* Luxury tax */
64 #define IN_JAIL 9 /* In jail */
66 #define JAIL 40 /* JAIL square number */
68 #define lucky(str) printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1])
69 #define printline() printf("------------------------------\n")
70 #define sqnum(sqp) ((short)(sqp - board))
72 struct sqr_st { /* structure for square */
73 const char *name; /* place name */
74 short owner; /* owner number */
75 short type; /* place type */
76 struct prp_st *desc; /* description struct */
77 int cost; /* cost */
80 typedef struct sqr_st SQUARE;
82 struct mon_st { /* monopoly description structure */
83 const char *name; /* monop. name (color) */
84 short owner; /* owner of monopoly */
85 short num_in; /* # in monopoly */
86 short num_own; /* # owned (-1: not poss. monop)*/
87 short h_cost; /* price of houses */
88 const char *not_m; /* name if not monopoly */
89 const char *mon_n; /* name if a monopoly */
90 unsigned char sqnums[3]; /* Square numbers (used to init)*/
91 SQUARE *sq[3]; /* list of squares in monop */
94 typedef struct mon_st MON;
97 * This struct describes a property. For railroads and utilities, only
98 * the "morg" member is used.
100 struct prp_st { /* property description structure */
101 bool morg; /* set if mortgaged */
102 bool monop; /* set if monopoly */
103 short square; /* square description */
104 short houses; /* number of houses */
105 MON *mon_desc; /* name of color */
106 int rent[6]; /* rents */
109 struct own_st { /* element in list owned things */
110 SQUARE *sqr; /* pointer to square */
111 struct own_st *next; /* next in list */
114 typedef struct own_st OWN;
116 struct plr_st { /* player description structure */
117 char *name; /* owner name */
118 short num_gojf; /* # of get-out-of-jail-free's */
119 short num_rr; /* # of railroads owned */
120 short num_util; /* # of water works/elec. co. */
121 short loc; /* location on board */
122 short in_jail; /* count of turns in jail */
123 int money; /* amount of money */
124 OWN *own_list; /* start of property list */
127 typedef struct plr_st PLAY;
128 typedef struct prp_st PROP;
129 typedef struct prp_st RR_S;
130 typedef struct prp_st UTIL_S;
132 extern bool trading, spec, fixing, told_em;
134 extern const char *const yncoms[], *name_list[], *const lucky_mes[];
136 extern int num_play, player, num_doub, num_luck;
138 extern void (*const func[])(void);
140 /*extern MON mon[N_MON];*/
142 extern PLAY *play, *cur_p;
144 extern PROP prop[N_PROP];
146 /*extern RR_S rr[N_RR];*/
148 extern SQUARE board[N_SQRS + 1];
150 /*extern UTIL_S util[2];*/
153 /* cards.c */
154 void ret_card(PLAY *);
156 /* execute.c */
157 void execute(int);
158 void do_move(void);
159 void move(int);
160 void save(void);
161 void restore(void);
162 int rest_f(const char *);
164 /* getinp.c */
165 int getinp(const char *, const char *const []);
167 /* houses.c */
168 void buy_houses(void);
169 void sell_houses(void);
171 /* jail.c */
172 void card(void);
173 void pay(void);
174 int move_jail(int, int );
175 void printturn(void);
177 /* misc.c */
178 int getyn(const char *);
179 void notify(void);
180 void next_play(void);
181 int get_int(const char *);
182 void set_ownlist(int);
183 void is_not_monop(MON *);
184 void list(void);
185 void list_all(void);
186 void quit(void);
188 /* morg.c */
189 void mortgage(void);
190 void unmortgage(void);
191 void force_morg(void);
193 /* print.c */
194 void printboard(void);
195 void where(void);
196 void printsq(int, bool);
197 void printhold(int);
199 /* prop.c */
200 void buy(int, SQUARE *);
201 void add_list(int, OWN **, int);
202 void del_list(int, OWN **, short);
203 void bid(void);
204 int prop_worth(PLAY *);
206 /* rent.c */
207 void rent(SQUARE *);
209 /* roll.c */
210 int roll(int, int);
212 /* spec.c */
213 void inc_tax(void);
214 void goto_jail(void);
215 void lux_tax(void);
216 void cc(void);
217 void chance(void);
219 /* trade.c */
220 void trade(void);
221 void resign(void);