+/* $NetBSD: houses.c,v 1.6 1999/09/08 21:17:51 jsm Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-/*static char sccsid[] = "from: @(#)houses.c 5.5 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: houses.c,v 1.2 1993/08/01 18:53:40 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)houses.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: houses.c,v 1.6 1999/09/08 21:17:51 jsm Exp $");
+#endif
#endif /* not lint */
-# include "monop.ext"
+#include "monop.ext"
-static char *names[N_MON+2],
- cur_prop[80];
+static const char *names[N_MON+2];
+static char cur_prop[80];
static MON *monops[N_MON];
+static void buy_h __P((MON *));
+static void sell_h __P((MON *));
+static void list_cur __P((MON *));
/*
* These routines deal with buying and selling houses
*/
-buy_houses() {
-
- reg int num_mon;
- reg MON *mp;
- reg OWN *op;
- bool good,got_morg;
- int i,p;
+void
+buy_houses()
+{
+ int num_mon;
+ MON *mp;
+ OWN *op;
+ bool good,got_morg;
+ int i,p;
over:
num_mon = 0;
else {
names[num_mon++] = "done";
names[num_mon--] = 0;
- if ((p=getinp("Which property do you wish to buy houses for? ", names)) == num_mon)
+ if ((p = getinp(
+ "Which property do you wish to buy houses for? ",
+ names)) == num_mon)
return;
buy_h(monops[p]);
goto over;
}
}
+static void
buy_h(mnp)
-MON *mnp; {
-
- reg int i;
- reg MON *mp;
- reg int price;
- shrt input[3],temp[3];
- int tot;
- PROP *pp;
+ MON *mnp;
+{
+ int i;
+ MON *mp;
+ int price;
+ short input[3],temp[3];
+ int tot;
+ PROP *pp;
mp = mnp;
price = mp->h_cost * 50;
tot += input[i];
if (tot) {
printf("You asked for %d houses for $%d\n", tot, tot * price);
- if (getyn("Is that ok? ", yn) == 0) {
+ if (getyn("Is that ok? ") == 0) {
cur_p->money -= tot * price;
for (tot = i = 0; i < mp->num_in; i++)
mp->sq[i]->desc->houses = temp[i];
/*
* This routine sells houses.
*/
-sell_houses() {
-
- reg int num_mon;
- reg MON *mp;
- reg OWN *op;
- bool good;
- int p;
+void
+sell_houses()
+{
+ int num_mon;
+ MON *mp;
+ OWN *op;
+ bool good;
+ int p;
over:
num_mon = 0;
else {
names[num_mon++] = "done";
names[num_mon--] = 0;
- if ((p=getinp("Which property do you wish to sell houses from? ", names)) == num_mon)
+ if ((p = getinp(
+ "Which property do you wish to sell houses from? ",
+ names)) == num_mon)
return;
sell_h(monops[p]);
notify();
}
}
+static void
sell_h(mnp)
-MON *mnp; {
-
- reg int i;
- reg MON *mp;
- reg int price;
- shrt input[3],temp[3];
- int tot;
- PROP *pp;
+ MON *mnp;
+{
+ int i;
+ MON *mp;
+ int price;
+ short input[3],temp[3];
+ int tot;
+ PROP *pp;
mp = mnp;
price = mp->h_cost * 25;
input[i] = get_int(cur_prop);
temp[i] = pp->houses - input[i];
if (temp[i] < 0) {
- printf("That's too many. The most you can sell is %d\n", pp->houses);
+ printf(
+ "That's too many. The most you can sell is %d\n",
+ pp->houses);
goto over;
}
}
tot += input[i];
if (tot) {
printf("You asked to sell %d houses for $%d\n",tot,tot * price);
- if (getyn("Is that ok? ", yn) == 0) {
+ if (getyn("Is that ok? ") == 0) {
cur_p->money += tot * price;
for (tot = i = 0; i < mp->num_in; i++)
mp->sq[i]->desc->houses = temp[i];
}
}
+static void
list_cur(mp)
-reg MON *mp; {
-
- reg int i;
- reg SQUARE *sqp;
+ MON *mp;
+{
+ int i;
+ SQUARE *sqp;
for (i = 0; i < mp->num_in; i++) {
sqp = mp->sq[i];