don't do a strlen() if length is provided
[unix-history] / usr / src / games / monop / spec.c
CommitLineData
3297b3e8 1/*
d99e6414 2 * Copyright (c) 1980 Regents of the University of California.
3297b3e8
KB
3 * All rights reserved.
4 *
102fca3d 5 * %sccs.include.redist.c%
3297b3e8
KB
6 */
7
8#ifndef lint
102fca3d 9static char sccsid[] = "@(#)spec.c 5.3 (Berkeley) %G%";
3297b3e8
KB
10#endif /* not lint */
11
12# include "monop.ext"
13
14static char *perc[] = {
15 "10%", "ten percent", "%", "$200", "200", 0
16 };
17
18inc_tax() { /* collect income tax */
19
20 reg int worth, com_num;
21
22 com_num = getinp("Do you wish to lose 10%% of your total worth or $200? ", perc);
23 worth = cur_p->money + prop_worth(cur_p);
24 printf("You were worth $%d", worth);
25 worth /= 10;
26 if (com_num > 2) {
27 if (worth < 200)
28 printf(". Good try, but not quite.\n");
29 else if (worth > 200)
30 lucky(".\nGood guess. ");
31 cur_p->money -= 200;
32 }
33 else {
34 printf(", so you pay $%d", worth);
35 if (worth > 200)
36 printf(" OUCH!!!!.\n");
37 else if (worth < 200)
38 lucky("\nGood guess. ");
39 cur_p->money -= worth;
40 }
41 if (worth == 200)
42 lucky("\nIt makes no difference! ");
43}
44goto_jail() { /* move player to jail */
45
46 cur_p->loc = JAIL;
47}
48lux_tax() { /* landing on luxury tax */
49
50 printf("You lose $75\n");
51 cur_p->money -= 75;
52}
53cc() { /* draw community chest card */
54
55 get_card(&CC_D);
56}
57chance() { /* draw chance card */
58
59 get_card(&CH_D);
60}