]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - monop/prop.c
1 /* $NetBSD: prop.c,v 1.3 1995/03/23 08:35:06 cgd Exp $ */
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
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. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 static char sccsid
[] = "@(#)prop.c 8.1 (Berkeley) 5/31/93";
40 static char rcsid
[] = "$NetBSD: prop.c,v 1.3 1995/03/23 08:35:06 cgd Exp $";
46 extern char *calloc();
49 * This routine deals with buying property, setting all the
58 add_list(player
, &(play
[player
].own_list
), cur_p
->loc
);
61 * This routine adds an item to the list.
63 add_list(plr
, head
, op_sqr
)
69 reg OWN
*tp
, *last_tp
;
73 op
= (OWN
*)calloc(1, sizeof (OWN
));
74 op
->sqr
= &board
[op_sqr
];
77 for (tp
= *head
; tp
&& value(tp
->sqr
) < val
; tp
= tp
->next
)
78 if (val
== value(tp
->sqr
)) {
93 * This routine deletes property from the list.
95 del_list(plr
, head
, op_sqr
)
101 reg OWN
*op
, *last_op
;
103 switch (board
[op_sqr
].type
) {
105 board
[op_sqr
].desc
->mon_desc
->num_own
--;
111 play
[plr
].num_util
--;
115 for (op
= *head
; op
; op
= op
->next
)
116 if (op
->sqr
== &board
[op_sqr
])
123 last_op
->next
= op
->next
;
128 * This routine calculates the value for sorting of the
140 default: /* Specials, etc */
150 return 8 + (sqp
->desc
) - prop
;
154 * This routine accepts bids for the current peice
159 static bool in
[MAX_PL
];
160 reg
int i
, num_in
, cur_max
;
164 printf("\nSo it goes up for auction. Type your bid after your name\n");
165 for (i
= 0; i
< num_play
; i
++)
170 while (num_in
> 1 || (cur_max
== 0 && num_in
> 0)) {
174 (void)sprintf(buf
, "%s: ", name_list
[i
]);
175 cur_bid
= get_int(buf
);
181 else if (cur_bid
<= cur_max
) {
182 printf("You must bid higher than %d to stay in\n", cur_max
);
183 printf("(bid of 0 drops you out)\n");
185 } while (cur_bid
!= 0 && cur_bid
<= cur_max
);
186 cur_max
= (cur_bid
? cur_bid
: cur_max
);
192 printf("It goes to %s (%d) for $%d\n",play
[i
].name
,i
+1,cur_max
);
193 buy(i
, &board
[cur_p
->loc
]);
194 play
[i
].money
-= cur_max
;
197 printf("Nobody seems to want it, so we'll leave it for later\n");
200 * This routine calculates the value of the property
210 for (op
= plp
->own_list
; op
; op
= op
->next
) {
211 if (op
->sqr
->type
== PRPTY
&& op
->sqr
->desc
->monop
)
212 worth
+= op
->sqr
->desc
->mon_desc
->h_cost
* 50 *
213 op
->sqr
->desc
->houses
;
214 worth
+= op
->sqr
->cost
;