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