133208Sbostic /* 234788Sbostic * Copyright (c) 1980 Regents of the University of California. 333208Sbostic * All rights reserved. 433208Sbostic * 5*42583Sbostic * %sccs.include.redist.c% 633208Sbostic */ 733208Sbostic 833208Sbostic #ifndef lint 9*42583Sbostic static char sccsid[] = "@(#)jail.c 5.3 (Berkeley) 06/01/90"; 1033208Sbostic #endif /* not lint */ 1133208Sbostic 1233208Sbostic # include "monop.ext" 1333208Sbostic 1433208Sbostic /* 1533208Sbostic * This routine uses a get-out-of-jail-free card to get the 1633208Sbostic * player out of jail. 1733208Sbostic */ 1833208Sbostic card() { 1933208Sbostic 2033208Sbostic if (cur_p->loc != JAIL) { 2133208Sbostic printf("But you're not IN Jail\n"); 2233208Sbostic return; 2333208Sbostic } 2433208Sbostic if (cur_p->num_gojf == 0) { 2533208Sbostic printf("But you don't HAVE a get out of jail free card\n"); 2633208Sbostic return; 2733208Sbostic } 2833208Sbostic ret_card(cur_p); 2933208Sbostic cur_p->loc = 10; /* just visiting */ 3033208Sbostic cur_p->in_jail = 0; 3133208Sbostic } 3233208Sbostic /* 3333208Sbostic * This routine returns the players get-out-of-jail-free card 3433208Sbostic * to a deck. 3533208Sbostic */ 3633208Sbostic ret_card(plr) 3733208Sbostic reg PLAY *plr; { 3833208Sbostic 3933208Sbostic plr->num_gojf--; 4033208Sbostic if (CC_D.gojf_used) 4133208Sbostic CC_D.gojf_used = FALSE; 4233208Sbostic else 4333208Sbostic CH_D.gojf_used = FALSE; 4433208Sbostic } 4533208Sbostic /* 4633208Sbostic * This routine deals with paying your way out of jail. 4733208Sbostic */ 4833208Sbostic pay() { 4933208Sbostic 5033208Sbostic if (cur_p->loc != JAIL) { 5133208Sbostic printf("But you're not IN Jail\n"); 5233208Sbostic return; 5333208Sbostic } 5433208Sbostic cur_p->loc = 10; 5533208Sbostic cur_p->money -= 50; 5633208Sbostic cur_p->in_jail = 0; 5733208Sbostic printf("That cost you $50\n"); 5833208Sbostic } 5933208Sbostic /* 6033208Sbostic * This routine deals with a move in jail 6133208Sbostic */ 6233208Sbostic move_jail(r1, r2) 6333208Sbostic reg int r1, r2; { 6433208Sbostic 6533208Sbostic if (r1 != r2) { 6633208Sbostic printf("Sorry, that doesn't get you out\n"); 6733208Sbostic if (++(cur_p->in_jail) == 3) { 6833208Sbostic printf("It's your third turn and you didn't roll doubles. You have to pay $50\n"); 6933208Sbostic cur_p->money -= 50; 7033208Sbostic moveit: 7133208Sbostic cur_p->loc = 10; 7233208Sbostic cur_p->in_jail = 0; 7333208Sbostic move(r1+r2); 7433208Sbostic r1 = r2 - 1; /* kludge: stop new roll w/doub */ 7533208Sbostic return TRUE; 7633208Sbostic } 7733208Sbostic return FALSE; 7833208Sbostic } 7933208Sbostic else { 8033208Sbostic printf("Double roll gets you out.\n"); 8133208Sbostic goto moveit; 8233208Sbostic } 8333208Sbostic } 8433208Sbostic printturn() { 8533208Sbostic 8633208Sbostic if (cur_p->loc != JAIL) 8733208Sbostic return; 8833208Sbostic printf("(This is your "); 8933208Sbostic switch (cur_p->in_jail) { 9033208Sbostic case 0: 9133208Sbostic printf("1st"); 9233208Sbostic break; 9333208Sbostic case 1: 9433208Sbostic printf("2nd"); 9533208Sbostic break; 9633208Sbostic case 2: 9733208Sbostic printf("3rd (and final)"); 9833208Sbostic break; 9933208Sbostic } 10033208Sbostic printf(" turn in JAIL)\n"); 10133208Sbostic } 102