Commit | Line | Data |
---|---|---|
fbd7d885 | 1 | /* |
d99e6414 | 2 | * Copyright (c) 1980 Regents of the University of California. |
fbd7d885 KB |
3 | * All rights reserved. |
4 | * | |
102fca3d | 5 | * %sccs.include.redist.c% |
fbd7d885 KB |
6 | */ |
7 | ||
8 | #ifndef lint | |
102fca3d | 9 | static char sccsid[] = "@(#)jail.c 5.3 (Berkeley) %G%"; |
fbd7d885 KB |
10 | #endif /* not lint */ |
11 | ||
12 | # include "monop.ext" | |
13 | ||
14 | /* | |
15 | * This routine uses a get-out-of-jail-free card to get the | |
16 | * player out of jail. | |
17 | */ | |
18 | card() { | |
19 | ||
20 | if (cur_p->loc != JAIL) { | |
21 | printf("But you're not IN Jail\n"); | |
22 | return; | |
23 | } | |
24 | if (cur_p->num_gojf == 0) { | |
25 | printf("But you don't HAVE a get out of jail free card\n"); | |
26 | return; | |
27 | } | |
28 | ret_card(cur_p); | |
29 | cur_p->loc = 10; /* just visiting */ | |
30 | cur_p->in_jail = 0; | |
31 | } | |
32 | /* | |
33 | * This routine returns the players get-out-of-jail-free card | |
34 | * to a deck. | |
35 | */ | |
36 | ret_card(plr) | |
37 | reg PLAY *plr; { | |
38 | ||
39 | plr->num_gojf--; | |
40 | if (CC_D.gojf_used) | |
41 | CC_D.gojf_used = FALSE; | |
42 | else | |
43 | CH_D.gojf_used = FALSE; | |
44 | } | |
45 | /* | |
46 | * This routine deals with paying your way out of jail. | |
47 | */ | |
48 | pay() { | |
49 | ||
50 | if (cur_p->loc != JAIL) { | |
51 | printf("But you're not IN Jail\n"); | |
52 | return; | |
53 | } | |
54 | cur_p->loc = 10; | |
55 | cur_p->money -= 50; | |
56 | cur_p->in_jail = 0; | |
57 | printf("That cost you $50\n"); | |
58 | } | |
59 | /* | |
60 | * This routine deals with a move in jail | |
61 | */ | |
62 | move_jail(r1, r2) | |
63 | reg int r1, r2; { | |
64 | ||
65 | if (r1 != r2) { | |
66 | printf("Sorry, that doesn't get you out\n"); | |
67 | if (++(cur_p->in_jail) == 3) { | |
68 | printf("It's your third turn and you didn't roll doubles. You have to pay $50\n"); | |
69 | cur_p->money -= 50; | |
70 | moveit: | |
71 | cur_p->loc = 10; | |
72 | cur_p->in_jail = 0; | |
73 | move(r1+r2); | |
74 | r1 = r2 - 1; /* kludge: stop new roll w/doub */ | |
75 | return TRUE; | |
76 | } | |
77 | return FALSE; | |
78 | } | |
79 | else { | |
80 | printf("Double roll gets you out.\n"); | |
81 | goto moveit; | |
82 | } | |
83 | } | |
84 | printturn() { | |
85 | ||
86 | if (cur_p->loc != JAIL) | |
87 | return; | |
88 | printf("(This is your "); | |
89 | switch (cur_p->in_jail) { | |
90 | case 0: | |
91 | printf("1st"); | |
92 | break; | |
93 | case 1: | |
94 | printf("2nd"); | |
95 | break; | |
96 | case 2: | |
97 | printf("3rd (and final)"); | |
98 | break; | |
99 | } | |
100 | printf(" turn in JAIL)\n"); | |
101 | } |