]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - monop/morg.c
2 * Copyright (c) 1980 Regents of the University of California.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 /*static char sccsid[] = "from: @(#)morg.c 5.4 (Berkeley) 3/25/93";*/
36 static char rcsid
[] = "$Id: morg.c,v 1.3 1993/08/07 08:28:05 mycroft Exp $";
42 * These routines deal with mortgaging.
45 static char *names
[MAX_PRP
+2],
50 "own holdings", /* 3 */
61 "restore game", /* 14 */
65 static shrt square
[MAX_PRP
+2];
67 static int num_good
,got_houses
;
70 * This routine is the command level response the mortgage command.
71 * it gets the list of mortgageable property and asks which are to
79 if (set_mlist() == 0) {
81 printf("You can't mortgage property with houses on it.\n");
83 printf("You don't have any un-mortgaged property.\n");
87 printf("Your only mortageable property is %s\n",names
[0]);
88 if (getyn("Do you want to mortgage it? ") == 0)
92 prop
= getinp("Which property do you want to mortgage? ",names
);
100 * This routine sets up the list of mortgageable property
107 for (op
= cur_p
->own_list
; op
; op
= op
->next
)
108 if (!op
->sqr
->desc
->morg
)
109 if (op
->sqr
->type
== PRPTY
&& op
->sqr
->desc
->houses
)
112 names
[num_good
] = op
->sqr
->name
;
113 square
[num_good
++] = sqnum(op
->sqr
);
115 names
[num_good
++] = "done";
116 names
[num_good
--] = 0;
120 * This routine actually mortgages the property.
127 price
= board
[prop
].cost
/2;
128 board
[prop
].desc
->morg
= TRUE
;
129 printf("That got you $%d\n",price
);
130 cur_p
->money
+= price
;
133 * This routine is the command level repsponse to the unmortgage
134 * command. It gets the list of mortgaged property and asks which are
142 if (set_umlist() == 0) {
143 printf("You don't have any mortgaged property.\n");
147 printf("Your only mortaged property is %s\n",names
[0]);
148 if (getyn("Do you want to unmortgage it? ") == 0)
152 prop
= getinp("Which property do you want to unmortgage? ",names
);
153 if (prop
== num_good
)
159 * This routine sets up the list of mortgaged property
166 for (op
= cur_p
->own_list
; op
; op
= op
->next
)
167 if (op
->sqr
->desc
->morg
) {
168 names
[num_good
] = op
->sqr
->name
;
169 square
[num_good
++] = sqnum(op
->sqr
);
171 names
[num_good
++] = "done";
172 names
[num_good
--] = 0;
176 * This routine actually unmortgages the property
183 price
= board
[prop
].cost
/2;
184 board
[prop
].desc
->morg
= FALSE
;
186 printf("That cost you $%d\n",price
);
187 cur_p
->money
-= price
;
191 * This routine forces the indebted player to fix his
196 told_em
= fixing
= TRUE
;
197 while (cur_p
->money
<= 0)
198 fix_ex(getinp("How are you going to fix it up? ",morg_coms
));
202 * This routine is a special execute for the force_morg routine