Commit | Line | Data |
---|---|---|
3847f417 | 1 | /* |
d99e6414 | 2 | * Copyright (c) 1980 Regents of the University of California. |
3847f417 KB |
3 | * All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
d99e6414 KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
3847f417 KB |
16 | */ |
17 | ||
18 | #ifndef lint | |
d99e6414 | 19 | static char sccsid[] = "@(#)rent.c 5.2 (Berkeley) %G%"; |
3847f417 KB |
20 | #endif /* not lint */ |
21 | ||
22 | # include "monop.ext" | |
23 | ||
24 | /* | |
25 | * This routine has the player pay rent | |
26 | */ | |
27 | rent(sqp) | |
28 | reg SQUARE *sqp; { | |
29 | ||
30 | reg int rnt; | |
31 | reg PROP *pp; | |
32 | PLAY *plp; | |
33 | ||
34 | plp = &play[sqp->owner]; | |
35 | printf("Owned by %s\n", plp->name); | |
36 | if (sqp->desc->morg) { | |
37 | lucky("The thing is mortgaged. "); | |
38 | return; | |
39 | } | |
40 | switch (sqp->type) { | |
41 | case PRPTY: | |
42 | pp = sqp->desc; | |
43 | if (pp->monop) | |
44 | if (pp->houses == 0) | |
45 | printf("rent is %d\n", rnt=pp->rent[0] * 2); | |
46 | else if (pp->houses < 5) | |
47 | printf("with %d houses, rent is %d\n", | |
48 | pp->houses, rnt=pp->rent[pp->houses]); | |
49 | else | |
50 | printf("with a hotel, rent is %d\n", | |
51 | rnt=pp->rent[pp->houses]); | |
52 | else | |
53 | printf("rent is %d\n", rnt = pp->rent[0]); | |
54 | break; | |
55 | case RR: | |
56 | rnt = 25; | |
57 | rnt <<= (plp->num_rr - 1); | |
58 | if (spec) | |
59 | rnt <<= 1; | |
60 | printf("rent is %d\n", rnt); | |
61 | break; | |
62 | case UTIL: | |
63 | rnt = roll(2, 6); | |
64 | if (plp->num_util == 2 || spec) { | |
65 | printf("rent is 10 * roll (%d) = %d\n", rnt, rnt * 10); | |
66 | rnt *= 10; | |
67 | } | |
68 | else { | |
69 | printf("rent is 4 * roll (%d) = %d\n", rnt, rnt * 4); | |
70 | rnt *= 4; | |
71 | } | |
72 | break; | |
73 | } | |
74 | cur_p->money -= rnt; | |
75 | plp->money += rnt; | |
76 | } |