BSD 4_3 development
[unix-history] / usr / src / games / monop / rent.c
CommitLineData
ef4e10da
C
1# include "monop.ext"
2
3/*
4 * This routine has the player pay rent
5 */
6rent(sqp)
7reg SQUARE *sqp; {
8
9 reg int rnt;
10 reg PROP *pp;
11 PLAY *plp;
12
13 plp = &play[sqp->owner];
14 printf("Owned by %s\n", plp->name);
15 if (sqp->desc->morg) {
16 lucky("The thing is mortgaged. ");
17 return;
18 }
19 switch (sqp->type) {
20 case PRPTY:
21 pp = sqp->desc;
22 if (pp->monop)
23 if (pp->houses == 0)
24 printf("rent is %d\n", rnt=pp->rent[0] * 2);
25 else if (pp->houses < 5)
26 printf("with %d houses, rent is %d\n",
27 pp->houses, rnt=pp->rent[pp->houses]);
28 else
29 printf("with a hotel, rent is %d\n",
30 rnt=pp->rent[pp->houses]);
31 else
32 printf("rent is %d\n", rnt = pp->rent[0]);
33 break;
34 case RR:
35 rnt = 25;
36 rnt <<= (plp->num_rr - 1);
37 if (spec)
38 rnt <<= 1;
39 printf("rent is %d\n", rnt);
40 break;
41 case UTIL:
42 rnt = roll(2, 6);
43 if (plp->num_util == 2 || spec) {
44 printf("rent is 10 * roll (%d) = %d\n", rnt, rnt * 10);
45 rnt *= 10;
46 }
47 else {
48 printf("rent is 4 * roll (%d) = %d\n", rnt, rnt * 4);
49 rnt *= 4;
50 }
51 break;
52 }
53 cur_p->money -= rnt;
54 plp->money += rnt;
55}