summaryrefslogtreecommitdiffstats
path: root/monop
diff options
context:
space:
mode:
authorsimonb <simonb@NetBSD.org>1999-08-21 10:40:03 +0000
committersimonb <simonb@NetBSD.org>1999-08-21 10:40:03 +0000
commite6fd9858739827671b4b260dd533f89f860a9fa7 (patch)
tree972e93ee56db748e5c589b841304a69ecc01bc25 /monop
parentca104a29f1236b5c4ee454e8c132ed8518df7a27 (diff)
downloadbsdgames-darwin-e6fd9858739827671b4b260dd533f89f860a9fa7.tar.gz
bsdgames-darwin-e6fd9858739827671b4b260dd533f89f860a9fa7.tar.zst
bsdgames-darwin-e6fd9858739827671b4b260dd533f89f860a9fa7.zip
Convert to something resembling KNF.
Diffstat (limited to 'monop')
-rw-r--r--monop/cards.c51
-rw-r--r--monop/deck.h8
-rw-r--r--monop/execute.c55
-rw-r--r--monop/getinp.c23
-rw-r--r--monop/houses.c73
-rw-r--r--monop/initdeck.c42
-rw-r--r--monop/jail.c19
-rw-r--r--monop/misc.c94
-rw-r--r--monop/monop.c40
-rw-r--r--monop/monop.def6
-rw-r--r--monop/monop.h62
-rw-r--r--monop/morg.c51
-rw-r--r--monop/print.c44
-rw-r--r--monop/prop.c63
-rw-r--r--monop/rent.c15
-rw-r--r--monop/roll.c29
-rw-r--r--monop/spec.c16
-rw-r--r--monop/trade.c57
18 files changed, 377 insertions, 371 deletions
diff --git a/monop/cards.c b/monop/cards.c
index 5f1adabc..fc7bde48 100644
--- a/monop/cards.c
+++ b/monop/cards.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cards.c,v 1.6 1999/08/21 09:23:44 simonb Exp $ */
+/* $NetBSD: cards.c,v 1.7 1999/08/21 10:40:03 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,26 +38,26 @@
#if 0
static char sccsid[] = "@(#)cards.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: cards.c,v 1.6 1999/08/21 09:23:44 simonb Exp $");
+__RCSID("$NetBSD: cards.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
#endif
#endif /* not lint */
-# include <sys/types.h>
-# include <sys/endian.h>
-# include "monop.ext"
-# include "pathnames.h"
+#include <sys/types.h>
+#include <sys/endian.h>
+#include "monop.ext"
+#include "pathnames.h"
/*
* These routine deal with the card decks
*/
-# define GOJF 'F' /* char for get-out-of-jail-free cards */
+#define GOJF 'F' /* char for get-out-of-jail-free cards */
-# ifndef DEV
+#ifndef DEV
static char *cardfile = _PATH_CARDS;
-# else
+#else
static char *cardfile = "cards.pck";
-# endif
+#endif
static FILE *deckf;
@@ -90,15 +90,16 @@ file_err:
set_up(&CC_D);
set_up(&CH_D);
}
+
/*
* This routine sets up the offset pointers for the given deck.
*/
static void
set_up(dp)
-DECK *dp; {
-
- int r1, r2;
- int i;
+ DECK *dp;
+{
+ int r1, r2;
+ int i;
dp->offsets = (off_t *) calloc(sizeof (off_t), dp->num_cards);
if (fread(dp->offsets, sizeof(off_t), dp->num_cards, deckf) !=
@@ -121,18 +122,18 @@ DECK *dp; {
dp->offsets[r1] = temp;
}
}
+
/*
* This routine draws a card from the given deck
*/
void
get_card(dp)
-DECK *dp;
+ DECK *dp;
{
-
- char type_maj, type_min;
- int num;
- int i, per_h, per_H, num_h, num_H;
- OWN *op;
+ char type_maj, type_min;
+ int num;
+ int i, per_h, per_H, num_h, num_H;
+ OWN *op;
do {
fseek(deckf, dp->offsets[dp->last_card], 0);
@@ -209,7 +210,9 @@ DECK *dp;
num_h += op->sqr->desc->houses;
}
num = per_h * num_h + per_H * num_H;
- printf("You had %d Houses and %d Hotels, so that cost you $%d\n", num_h, num_H, num);
+ printf(
+ "You had %d Houses and %d Hotels, so that cost you $%d\n",
+ num_h, num_H, num);
if (num == 0)
lucky("");
else
@@ -227,9 +230,9 @@ DECK *dp;
* This routine prints out the message on the card
*/
static void
-printmes() {
-
- char c;
+printmes()
+{
+ char c;
printline();
fflush(stdout);
diff --git a/monop/deck.h b/monop/deck.h
index 618fc2a7..947b58cc 100644
--- a/monop/deck.h
+++ b/monop/deck.h
@@ -1,4 +1,4 @@
-/* $NetBSD: deck.h,v 1.4 1999/08/21 09:23:44 simonb Exp $ */
+/* $NetBSD: deck.h,v 1.5 1999/08/21 10:40:03 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -37,10 +37,10 @@
#include <sys/types.h>
-# define bool char
+#define bool char
-# define CC_D deck[0]
-# define CH_D deck[1]
+#define CC_D deck[0]
+#define CH_D deck[1]
struct dk_st { /* deck description structure */
int num_cards; /* number of cards in deck */
diff --git a/monop/execute.c b/monop/execute.c
index 3e9aa0a3..505bbc4e 100644
--- a/monop/execute.c
+++ b/monop/execute.c
@@ -1,4 +1,4 @@
-/* $NetBSD: execute.c,v 1.5 1998/09/11 13:54:08 hubertf Exp $ */
+/* $NetBSD: execute.c,v 1.6 1999/08/21 10:40:03 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)execute.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: execute.c,v 1.5 1998/09/11 13:54:08 hubertf Exp $");
+__RCSID("$NetBSD: execute.c,v 1.6 1999/08/21 10:40:03 simonb Exp $");
#endif
#endif /* not lint */
@@ -50,7 +50,7 @@ __RCSID("$NetBSD: execute.c,v 1.5 1998/09/11 13:54:08 hubertf Exp $");
#include <sys/stat.h>
#include <sys/time.h>
-# define SEGSIZE 8192
+#define SEGSIZE 8192
typedef struct stat STAT;
typedef struct tm TIME;
@@ -66,9 +66,8 @@ static void show_move __P((void));
*/
void
execute(com_num)
-int com_num;
+ int com_num;
{
-
new_play = FALSE; /* new_play is true if fixing */
(*func[com_num])();
notify();
@@ -78,15 +77,15 @@ int com_num;
else if (num_doub)
printf("%s rolled doubles. Goes again\n", cur_p->name);
}
+
/*
* This routine moves a piece around.
*/
void
do_move()
{
-
- int r1, r2;
- bool was_jail;
+ int r1, r2;
+ bool was_jail;
new_play = was_jail = FALSE;
printf("roll is %d, %d\n", r1=roll(1, 6), r2=roll(1, 6));
@@ -111,15 +110,15 @@ do_move()
ret:
return;
}
+
/*
* This routine moves a normal move
*/
void
move(rl)
-int rl;
+ int rl;
{
-
- int old_loc;
+ int old_loc;
old_loc = cur_p->loc;
cur_p->loc = (cur_p->loc + rl) % N_SQRS;
@@ -129,14 +128,14 @@ int rl;
}
show_move();
}
+
/*
* This routine shows the results of a move
*/
static void
show_move()
{
-
- SQUARE *sqp;
+ SQUARE *sqp;
sqp = &board[cur_p->loc];
printf("That puts you on %s\n", sqp->name);
@@ -172,18 +171,18 @@ show_move()
rent(sqp);
}
}
+
/*
* This routine saves the current game for use at a later date
*/
void
save()
{
-
- char *sp;
- int outf, num;
- time_t t;
- struct stat sb;
- char *start, *end;
+ char *sp;
+ int outf, num;
+ time_t t;
+ struct stat sb;
+ char *start, *end;
printf("Which file do you wish to save it in? ");
sp = buf;
@@ -219,14 +218,14 @@ save()
close(outf);
printf("[%s]\n", buf);
}
+
/*
* This routine restores an old game from a file
*/
void
restore()
{
-
- char *sp;
+ char *sp;
printf("Which file do you wish to restore from? ");
for (sp = buf; (*sp=getchar()) != '\n'; sp++)
@@ -234,20 +233,20 @@ restore()
*sp = '\0';
rest_f(buf);
}
+
/*
* This does the actual restoring. It returns TRUE if the
* backup was successful, else false.
*/
int
rest_f(file)
-char *file;
+ char *file;
{
-
- char *sp;
- int inf, num;
- char buf[80];
- char *start, *end;
- STAT sbuf;
+ char *sp;
+ int inf, num;
+ char buf[80];
+ char *start, *end;
+ STAT sbuf;
if ((inf=open(file, O_RDONLY)) < 0) {
perror(file);
diff --git a/monop/getinp.c b/monop/getinp.c
index cbb8dc42..84d4548c 100644
--- a/monop/getinp.c
+++ b/monop/getinp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: getinp.c,v 1.6 1997/10/12 17:45:10 christos Exp $ */
+/* $NetBSD: getinp.c,v 1.7 1999/08/21 10:40:03 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getinp.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: getinp.c,v 1.6 1997/10/12 17:45:10 christos Exp $");
+__RCSID("$NetBSD: getinp.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
#endif
#endif /* not lint */
@@ -47,7 +47,7 @@ __RCSID("$NetBSD: getinp.c,v 1.6 1997/10/12 17:45:10 christos Exp $");
#include <ctype.h>
#include "monop.ext"
-# define LINE 70
+#define LINE 70
static char buf[257];
@@ -55,12 +55,11 @@ static int comp __P((char *));
int
getinp(prompt, list)
-char *prompt, *list[];
+ char *prompt, *list[];
{
-
- int i, n_match, match = 0;
- char *sp;
- int c;
+ int i, n_match, match = 0;
+ char *sp;
+ int c;
for (;;) {
inter:
@@ -106,16 +105,16 @@ inter:
if (n_match == 1)
return match;
else if (buf[0] != '\0')
- printf("Illegal response: \"%s\". Use '?' to get list of valid answers\n", buf);
+ printf("Illegal response: \"%s\". "
+ "Use '?' to get list of valid answers\n", buf);
}
}
static int
comp(s1)
-char *s1;
+ char *s1;
{
-
- char *sp, *tsp, c;
+ char *sp, *tsp, c;
if (buf[0] != '\0')
for (sp = buf, tsp = s1; *sp; ) {
diff --git a/monop/houses.c b/monop/houses.c
index bda0ad7b..79a9703d 100644
--- a/monop/houses.c
+++ b/monop/houses.c
@@ -1,4 +1,4 @@
-/* $NetBSD: houses.c,v 1.4 1997/10/12 17:45:11 christos Exp $ */
+/* $NetBSD: houses.c,v 1.5 1999/08/21 10:40:03 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)houses.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: houses.c,v 1.4 1997/10/12 17:45:11 christos Exp $");
+__RCSID("$NetBSD: houses.c,v 1.5 1999/08/21 10:40:03 simonb Exp $");
#endif
#endif /* not lint */
@@ -58,12 +58,11 @@ static void list_cur __P((MON *));
void
buy_houses()
{
-
int num_mon;
- MON *mp;
- OWN *op;
- bool good,got_morg;
- int i,p;
+ MON *mp;
+ OWN *op;
+ bool good,got_morg;
+ int i,p;
over:
num_mon = 0;
@@ -103,7 +102,9 @@ over:
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;
@@ -112,15 +113,14 @@ over:
static void
buy_h(mnp)
-MON *mnp;
+ MON *mnp;
{
-
- int i;
- MON *mp;
- int price;
- short input[3],temp[3];
- int tot;
- PROP *pp;
+ int i;
+ MON *mp;
+ int price;
+ short input[3],temp[3];
+ int tot;
+ PROP *pp;
mp = mnp;
price = mp->h_cost * 50;
@@ -172,12 +172,11 @@ err: printf("That makes the spread too wide. Try again\n");
void
sell_houses()
{
-
- int num_mon;
- MON *mp;
- OWN *op;
- bool good;
- int p;
+ int num_mon;
+ MON *mp;
+ OWN *op;
+ bool good;
+ int p;
over:
num_mon = 0;
@@ -205,7 +204,9 @@ over:
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();
@@ -215,15 +216,14 @@ over:
static void
sell_h(mnp)
-MON *mnp;
+ MON *mnp;
{
-
- int i;
- MON *mp;
- int price;
- short input[3],temp[3];
- int tot;
- PROP *pp;
+ int i;
+ MON *mp;
+ int price;
+ short input[3],temp[3];
+ int tot;
+ PROP *pp;
mp = mnp;
price = mp->h_cost * 25;
@@ -247,7 +247,9 @@ over:
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;
}
}
@@ -272,11 +274,10 @@ err: printf("That makes the spread too wide. Try again\n");
static void
list_cur(mp)
-MON *mp;
+ MON *mp;
{
-
- int i;
- SQUARE *sqp;
+ int i;
+ SQUARE *sqp;
for (i = 0; i < mp->num_in; i++) {
sqp = mp->sq[i];
diff --git a/monop/initdeck.c b/monop/initdeck.c
index d066ed6d..9474f43d 100644
--- a/monop/initdeck.c
+++ b/monop/initdeck.c
@@ -1,4 +1,4 @@
-/* $NetBSD: initdeck.c,v 1.6 1999/08/21 09:23:44 simonb Exp $ */
+/* $NetBSD: initdeck.c,v 1.7 1999/08/21 10:40:03 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)initdeck.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: initdeck.c,v 1.6 1999/08/21 09:23:44 simonb Exp $");
+__RCSID("$NetBSD: initdeck.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
#endif
#endif /* not lint */
@@ -64,11 +64,10 @@ __RCSID("$NetBSD: initdeck.c,v 1.6 1999/08/21 09:23:44 simonb Exp $");
* string to print, terminated with a null byte.
*/
-# define TRUE 1
-# define FALSE 0
+#define TRUE 1
+#define FALSE 0
-# define bool char
-# define reg register
+#define bool char
char *infile = "cards.inp", /* input file */
*outfile = "cards.pck"; /* "packed" file */
@@ -85,9 +84,9 @@ static void putem __P((void));
int
main(ac, av)
-int ac;
-char *av[]; {
-
+ int ac;
+ char *av[];
+{
int i;
int32_t nc;
@@ -142,16 +141,16 @@ char *av[]; {
fwrite(CH_D.offsets, sizeof (off_t), CH_D.num_cards, outf);
fclose(outf);
- printf("There were %d com. chest and %d chance cards\n", CC_D.num_cards, CH_D.num_cards);
+ printf("There were %d com. chest and %d chance cards\n",
+ CC_D.num_cards, CH_D.num_cards);
exit(0);
}
static void
getargs(ac, av)
-int ac;
-char *av[];
+ int ac;
+ char *av[];
{
-
if (ac > 1)
infile = av[1];
if (ac > 2)
@@ -164,10 +163,9 @@ char *av[];
static void
count()
{
-
- reg bool newline;
- reg DECK *in_deck;
- reg int c;
+ bool newline;
+ DECK *in_deck;
+ int c;
newline = TRUE;
in_deck = &CC_D;
@@ -182,17 +180,17 @@ count()
newline = (c == '\n');
in_deck->num_cards++;
}
+
/*
* put strings in the file
*/
static void
putem()
{
-
- reg bool newline;
- reg DECK *in_deck;
- reg int c;
- reg int num;
+ bool newline;
+ DECK *in_deck;
+ int c;
+ int num;
in_deck = &CC_D;
CC_D.num_cards = 1;
diff --git a/monop/jail.c b/monop/jail.c
index 8c03e9bf..8aa5360b 100644
--- a/monop/jail.c
+++ b/monop/jail.c
@@ -1,4 +1,4 @@
-/* $NetBSD: jail.c,v 1.4 1997/10/12 17:45:14 christos Exp $ */
+/* $NetBSD: jail.c,v 1.5 1999/08/21 10:40:03 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)jail.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: jail.c,v 1.4 1997/10/12 17:45:14 christos Exp $");
+__RCSID("$NetBSD: jail.c,v 1.5 1999/08/21 10:40:03 simonb Exp $");
#endif
#endif /* not lint */
@@ -51,7 +51,6 @@ __RCSID("$NetBSD: jail.c,v 1.4 1997/10/12 17:45:14 christos Exp $");
void
card()
{
-
if (cur_p->loc != JAIL) {
printf("But you're not IN Jail\n");
return;
@@ -64,28 +63,28 @@ card()
cur_p->loc = 10; /* just visiting */
cur_p->in_jail = 0;
}
+
/*
* This routine returns the players get-out-of-jail-free card
* to a deck.
*/
void
ret_card(plr)
-PLAY *plr;
+ PLAY *plr;
{
-
plr->num_gojf--;
if (CC_D.gojf_used)
CC_D.gojf_used = FALSE;
else
CH_D.gojf_used = FALSE;
}
+
/*
* This routine deals with paying your way out of jail.
*/
void
pay()
{
-
if (cur_p->loc != JAIL) {
printf("But you're not IN Jail\n");
return;
@@ -95,18 +94,19 @@ pay()
cur_p->in_jail = 0;
printf("That cost you $50\n");
}
+
/*
* This routine deals with a move in jail
*/
int
move_jail(r1, r2)
-int r1, r2;
+ int r1, r2;
{
-
if (r1 != r2) {
printf("Sorry, that doesn't get you out\n");
if (++(cur_p->in_jail) == 3) {
- printf("It's your third turn and you didn't roll doubles. You have to pay $50\n");
+ printf("It's your third turn and you didn't roll "
+ "doubles. You have to pay $50\n");
cur_p->money -= 50;
moveit:
cur_p->loc = 10;
@@ -126,7 +126,6 @@ moveit:
void
printturn()
{
-
if (cur_p->loc != JAIL)
return;
printf("(This is your ");
diff --git a/monop/misc.c b/monop/misc.c
index 20d5c367..f659cac1 100644
--- a/monop/misc.c
+++ b/monop/misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.6 1997/10/12 17:45:15 christos Exp $ */
+/* $NetBSD: misc.c,v 1.7 1999/08/21 10:40:03 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,13 +38,13 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: misc.c,v 1.6 1997/10/12 17:45:15 christos Exp $");
+__RCSID("$NetBSD: misc.c,v 1.7 1999/08/21 10:40:03 simonb Exp $");
#endif
#endif /* not lint */
-# include "monop.ext"
-# include <ctype.h>
-# include <signal.h>
+#include "monop.ext"
+#include <ctype.h>
+#include <signal.h>
/*
* This routine executes a truncated set of commands until a
@@ -52,10 +52,9 @@ __RCSID("$NetBSD: misc.c,v 1.6 1997/10/12 17:45:15 christos Exp $");
*/
int
getyn(prompt)
-char *prompt;
+ char *prompt;
{
-
- int com;
+ int com;
for (;;)
if ((com=getinp(prompt, yn)) < 2)
@@ -63,13 +62,13 @@ char *prompt;
else
(*func[com-2])();
}
+
/*
* This routine tells the player if he's out of money.
*/
void
notify()
{
-
if (cur_p->money < 0)
printf("That leaves you $%d in debt\n", -cur_p->money);
else if (cur_p->money == 0)
@@ -79,30 +78,30 @@ notify()
told_em = TRUE;
}
}
+
/*
* This routine switches to the next player
*/
void
next_play()
{
-
player = ++player % num_play;
cur_p = &play[player];
num_doub = 0;
}
+
/*
* This routine gets an integer from the keyboard after the
* given prompt.
*/
int
get_int(prompt)
-char *prompt;
+ char *prompt;
{
-
- int num;
- char *sp;
- int c;
- char buf[257];
+ int num;
+ char *sp;
+ int c;
+ char buf[257];
for (;;) {
inter:
@@ -124,18 +123,18 @@ inter:
printf("I can't understand that\n");
}
}
+
/*
* This routine sets the monopoly flag from the list given.
*/
void
set_ownlist(pl)
-int pl;
+ int pl;
{
-
- int num; /* general counter */
- MON *orig; /* remember starting monop ptr */
- OWN *op; /* current owned prop */
- OWN *orig_op; /* origianl prop before loop */
+ int num; /* general counter */
+ MON *orig; /* remember starting monop ptr */
+ OWN *op; /* current owned prop */
+ OWN *orig_op; /* origianl prop before loop */
op = play[pl].own_list;
#ifdef DEBUG
@@ -150,7 +149,8 @@ int pl;
#ifdef DEBUG
printf(" case UTIL:\n");
#endif
- for (num = 0; op && op->sqr->type == UTIL; op = op->next)
+ for (num = 0; op && op->sqr->type == UTIL;
+ op = op->next)
num++;
play[pl].num_util = num;
#ifdef DEBUG
@@ -161,10 +161,13 @@ int pl;
#ifdef DEBUG
printf(" case RR:\n");
#endif
- for (num = 0; op && op->sqr->type == RR; op = op->next) {
+ for (num = 0; op && op->sqr->type == RR;
+ op = op->next) {
#ifdef DEBUG
printf("iter: %d\n", num);
- printf("op = %d, op->sqr = %d, op->sqr->type = %d\n", op, op->sqr, op->sqr->type);
+ printf("op = %d, op->sqr = %d, "
+ "op->sqr->type = %d\n", op, op->sqr,
+ op->sqr->type);
#endif
num++;
}
@@ -197,15 +200,19 @@ int pl;
printf("num = %d\n");
#endif
if (orig == 0) {
- printf("panic: bad monopoly descriptor: orig = %p\n", orig);
+ printf("panic: bad monopoly descriptor: "
+ "orig = %p\n", orig);
printf("player # %d\n", pl+1);
printhold(pl);
printf("orig_op = %p\n", orig_op);
- printf("orig_op->sqr->type = %d (PRPTY)\n", op->sqr->type);
+ printf("orig_op->sqr->type = %d (PRPTY)\n",
+ op->sqr->type);
printf("orig_op->next = %p\n", op->next);
- printf("orig_op->sqr->desc = %p\n", op->sqr->desc);
+ printf("orig_op->sqr->desc = %p\n",
+ op->sqr->desc);
printf("op = %p\n", op);
- printf("op->sqr->type = %d (PRPTY)\n", op->sqr->type);
+ printf("op->sqr->type = %d (PRPTY)\n",
+ op->sqr->type);
printf("op->next = %p\n", op->next);
printf("op->sqr->desc = %p\n", op->sqr->desc);
printf("num = %d\n", num);
@@ -221,16 +228,16 @@ int pl;
}
}
}
+
/*
* This routine sets things up as if it is a new monopoly
*/
void
is_monop(mp, pl)
-MON *mp;
-int pl;
+ MON *mp;
+ int pl;
{
-
- int i;
+ int i;
mp->owner = pl;
mp->num_own = mp->num_in;
@@ -238,49 +245,50 @@ int pl;
mp->sq[i]->desc->monop = TRUE;
mp->name = mp->mon_n;
}
+
/*
* This routine sets things up as if it is no longer a monopoly
*/
void
isnot_monop(mp)
-MON *mp;
+ MON *mp;
{
-
- int i;
+ int i;
mp->owner = -1;
for (i = 0; i < mp->num_in; i++)
mp->sq[i]->desc->monop = FALSE;
mp->name = mp->not_m;
}
+
/*
* This routine gives a list of the current player's routine
*/
void
-list()
+list()
{
-
printhold(player);
}
+
/*
* This routine gives a list of a given players holdings
*/
void
-list_all()
+list_all()
{
+ int pl;
- int pl;
-
- while ((pl=getinp("Whose holdings do you want to see? ", name_list)) < num_play)
+ while ((pl = getinp("Whose holdings do you want to see? ", name_list))
+ < num_play)
printhold(pl);
}
+
/*
* This routine gives the players a chance before it exits.
*/
void
quit()
{
-
putchar('\n');
if (getyn("Do you all really want to quit? ") == 0)
exit(0);
diff --git a/monop/monop.c b/monop/monop.c
index 53fd35b8..f0cf83d1 100644
--- a/monop/monop.c
+++ b/monop/monop.c
@@ -1,4 +1,4 @@
-/* $NetBSD: monop.c,v 1.5 1998/09/11 13:54:08 hubertf Exp $ */
+/* $NetBSD: monop.c,v 1.6 1999/08/21 10:40:03 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)monop.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: monop.c,v 1.5 1998/09/11 13:54:08 hubertf Exp $");
+__RCSID("$NetBSD: monop.c,v 1.6 1999/08/21 10:40:03 simonb Exp $");
#endif
#endif /* not lint */
@@ -64,10 +64,9 @@ static void do_quit __P((int));
*/
int
main(ac, av)
-int ac;
-char *av[]; {
-
-
+ int ac;
+ char *av[];
+{
srand(getpid());
if (ac > 1) {
if (!rest_f(av[1]))
@@ -97,16 +96,16 @@ do_quit(n)
{
quit();
}
+
/*
* This routine gets the names of the players
*/
static void
getplayers()
{
-
- char *sp;
- int i, j;
- char buf[257];
+ char *sp;
+ int i, j;
+ char buf[257];
blew_it:
for (;;) {
@@ -134,25 +133,28 @@ over:
for (j = i + 1; j < num_play; j++)
if (strcasecmp(name_list[i], name_list[j]) == 0) {
if (i != num_play - 1)
- printf("Hey!!! Some of those are IDENTICAL!! Let's try that again....\n");
+ printf("Hey!!! Some of those are "
+ "IDENTICAL!! Let's try that "
+ "again....\n");
else
- printf("\"done\" is a reserved word. Please try again\n");
+ printf("\"done\" is a reserved word. "
+ "Please try again\n");
for (i = 0; i < num_play; i++)
free(play[i].name);
free(play);
goto blew_it;
}
}
+
/*
* This routine figures out who goes first
*/
static void
init_players()
{
-
- int i, rl, cur_max;
- bool over = 0;
- int max_pl = 0;
+ int i, rl, cur_max;
+ bool over = 0;
+ int max_pl = 0;
again:
putchar('\n');
@@ -175,15 +177,15 @@ again:
cur_p = &play[max_pl];
printf("%s (%d) goes first\n", cur_p->name, max_pl + 1);
}
+
/*
* This routine initalizes the monopoly structures.
*/
static void
init_monops()
{
-
- MON *mp;
- int i;
+ MON *mp;
+ int i;
for (mp = mon; mp < &mon[N_MON]; mp++) {
mp->name = mp->not_m;
diff --git a/monop/monop.def b/monop/monop.def
index 54ecd6c9..08700bb2 100644
--- a/monop/monop.def
+++ b/monop/monop.def
@@ -1,4 +1,4 @@
-/* $NetBSD: monop.def,v 1.4 1997/10/12 17:45:18 christos Exp $ */
+/* $NetBSD: monop.def,v 1.5 1999/08/21 10:40:04 simonb Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -35,8 +35,8 @@
* @(#)monop.def 5.5 (Berkeley) 5/31/93
*/
-# include "deck.h"
-# include "monop.h"
+#include "deck.h"
+#include "monop.h"
bool fixing, /* set if fixing up debt */
trading, /* set if in process of trading */
diff --git a/monop/monop.h b/monop/monop.h
index adb8703d..4618cefa 100644
--- a/monop/monop.h
+++ b/monop/monop.h
@@ -1,4 +1,4 @@
-/* $NetBSD: monop.h,v 1.6 1997/10/12 17:45:20 christos Exp $ */
+/* $NetBSD: monop.h,v 1.7 1999/08/21 10:40:04 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -35,41 +35,41 @@
* @(#)monop.h 8.1 (Berkeley) 5/31/93
*/
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
-# define bool char
+#define bool char
-# define TRUE (1)
-# define FALSE (0)
+#define TRUE (1)
+#define FALSE (0)
-# define N_MON 8 /* number of monopolies */
-# define N_PROP 22 /* number of normal property squares */
-# define N_RR 4 /* number of railroads */
-# define N_UTIL 2 /* number of utilities */
-# define N_SQRS 40 /* number of squares on board */
-# define MAX_PL 9 /* maximum number of players */
-# define MAX_PRP (N_PROP+N_RR+N_UTIL) /* max # ownable property */
+#define N_MON 8 /* number of monopolies */
+#define N_PROP 22 /* number of normal property squares */
+#define N_RR 4 /* number of railroads */
+#define N_UTIL 2 /* number of utilities */
+#define N_SQRS 40 /* number of squares on board */
+#define MAX_PL 9 /* maximum number of players */
+#define MAX_PRP (N_PROP+N_RR+N_UTIL) /* max # ownable property */
/* square type numbers */
-# define PRPTY 0 /* normal property */
-# define RR 1 /* railroad */
-# define UTIL 2 /* water works - electric co */
-# define SAFE 3 /* safe spot */
-# define CC 4 /* community chest */
-# define CHANCE 5 /* chance (surprise!!!) */
-# define INC_TAX 6 /* Income tax */
-# define GOTO_J 7 /* Go To Jail! */
-# define LUX_TAX 8 /* Luxury tax */
-# define IN_JAIL 9 /* In jail */
-
-# define JAIL 40 /* JAIL square number */
-
-# define lucky(str) printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1])
-# define printline() printf("------------------------------\n")
-# define sqnum(sqp) (sqp - board)
-# define swap(A1,A2) if ((A1) != (A2)) { \
+#define PRPTY 0 /* normal property */
+#define RR 1 /* railroad */
+#define UTIL 2 /* water works - electric co */
+#define SAFE 3 /* safe spot */
+#define CC 4 /* community chest */
+#define CHANCE 5 /* chance (surprise!!!) */
+#define INC_TAX 6 /* Income tax */
+#define GOTO_J 7 /* Go To Jail! */
+#define LUX_TAX 8 /* Luxury tax */
+#define IN_JAIL 9 /* In jail */
+
+#define JAIL 40 /* JAIL square number */
+
+#define lucky(str) printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1])
+#define printline() printf("------------------------------\n")
+#define sqnum(sqp) (sqp - board)
+#define swap(A1,A2) if ((A1) != (A2)) { \
(A1) ^= (A2); \
(A2) ^= (A1); \
(A1) ^= (A2); \
diff --git a/monop/morg.c b/monop/morg.c
index e7f37f3f..80860f63 100644
--- a/monop/morg.c
+++ b/monop/morg.c
@@ -1,4 +1,4 @@
-/* $NetBSD: morg.c,v 1.6 1998/08/30 09:19:39 veego Exp $ */
+/* $NetBSD: morg.c,v 1.7 1999/08/21 10:40:04 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,11 +38,11 @@
#if 0
static char sccsid[] = "@(#)morg.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: morg.c,v 1.6 1998/08/30 09:19:39 veego Exp $");
+__RCSID("$NetBSD: morg.c,v 1.7 1999/08/21 10:40:04 simonb Exp $");
#endif
#endif /* not lint */
-# include "monop.ext"
+#include "monop.ext"
/*
* These routines deal with mortgaging.
@@ -87,19 +87,21 @@ static void fix_ex __P((int));
void
mortgage()
{
-
- int prop;
+ int prop;
for (;;) {
if (set_mlist() == 0) {
if (got_houses)
- printf("You can't mortgage property with houses on it.\n");
+ printf("You can't mortgage property with "
+ "houses on it.\n");
else
- printf("You don't have any un-mortgaged property.\n");
+ printf("You don't have any un-mortgaged "
+ "property.\n");
return;
}
if (num_good == 1) {
- printf("Your only mortageable property is %s\n",names[0]);
+ printf("Your only mortageable property is %s\n",
+ names[0]);
if (getyn("Do you want to mortgage it? ") == 0)
m(square[0]);
return;
@@ -111,14 +113,14 @@ mortgage()
notify();
}
}
+
/*
* This routine sets up the list of mortgageable property
*/
static int
set_mlist()
{
-
- OWN *op;
+ OWN *op;
num_good = 0;
for (op = cur_p->own_list; op; op = op->next)
@@ -134,21 +136,22 @@ set_mlist()
names[num_good--] = 0;
return num_good;
}
+
/*
* This routine actually mortgages the property.
*/
static void
m(prop)
-int prop;
+ int prop;
{
-
- int price;
+ int price;
price = board[prop].cost/2;
board[prop].desc->morg = TRUE;
printf("That got you $%d\n",price);
cur_p->money += price;
}
+
/*
* This routine is the command level repsponse to the unmortgage
* command. It gets the list of mortgaged property and asks which are
@@ -157,8 +160,7 @@ int prop;
void
unmortgage()
{
-
- int prop;
+ int prop;
for (;;) {
if (set_umlist() == 0) {
@@ -171,20 +173,21 @@ unmortgage()
unm(square[0]);
return;
}
- prop = getinp("Which property do you want to unmortgage? ",names);
+ prop = getinp("Which property do you want to unmortgage? ",
+ names);
if (prop == num_good)
return;
unm(square[prop]);
}
}
+
/*
* This routine sets up the list of mortgaged property
*/
static int
set_umlist()
{
-
- OWN *op;
+ OWN *op;
num_good = 0;
for (op = cur_p->own_list; op; op = op->next)
@@ -196,15 +199,15 @@ set_umlist()
names[num_good--] = 0;
return num_good;
}
+
/*
* This routine actually unmortgages the property
*/
static void
unm(prop)
-int prop;
+ int prop;
{
-
- int price;
+ int price;
price = board[prop].cost/2;
board[prop].desc->morg = FALSE;
@@ -213,6 +216,7 @@ int prop;
cur_p->money -= price;
set_umlist();
}
+
/*
* This routine forces the indebted player to fix his
* financial woes.
@@ -220,20 +224,19 @@ int prop;
void
force_morg()
{
-
told_em = fixing = TRUE;
while (cur_p->money <= 0)
fix_ex(getinp("How are you going to fix it up? ",morg_coms));
fixing = FALSE;
}
+
/*
* This routine is a special execute for the force_morg routine
*/
static void
fix_ex(com_num)
-int com_num;
+ int com_num;
{
-
told_em = FALSE;
(*func[com_num])();
notify();
diff --git a/monop/print.c b/monop/print.c
index 0b921d77..a55434f1 100644
--- a/monop/print.c
+++ b/monop/print.c
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.4 1997/10/12 17:45:22 christos Exp $ */
+/* $NetBSD: print.c,v 1.5 1999/08/21 10:40:04 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,11 +38,11 @@
#if 0
static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: print.c,v 1.4 1997/10/12 17:45:22 christos Exp $");
+__RCSID("$NetBSD: print.c,v 1.5 1999/08/21 10:40:04 simonb Exp $");
#endif
#endif /* not lint */
-# include "monop.ext"
+#include "monop.ext"
static char *header = "Name Own Price Mg # Rent";
@@ -54,8 +54,7 @@ static void printmorg __P((SQUARE *));
void
printboard()
{
-
- int i;
+ int i;
printf("%s\t%s\n", header, header);
for (i = 0; i < N_SQRS/2; i++) {
@@ -64,14 +63,14 @@ printboard()
printsq(i+N_SQRS/2, TRUE);
}
}
+
/*
* This routine lists where each player is.
*/
void
where()
{
-
- int i;
+ int i;
printf("%s Player\n", header);
for (i = 0; i < num_play; i++) {
@@ -82,18 +81,18 @@ where()
putchar('\n');
}
}
+
/*
* This routine prints out an individual square
*/
void
printsq(sqn, eoln)
-int sqn;
-bool eoln;
+ int sqn;
+ bool eoln;
{
-
- int rnt;
- PROP *pp;
- SQUARE *sqp;
+ int rnt;
+ PROP *pp;
+ SQUARE *sqp;
sqp = &board[sqn];
printf("%-10.10s", sqp->name);
@@ -156,39 +155,40 @@ bool eoln;
printmorg(sqp);
rnt = 25;
rnt <<= play[sqp->owner].num_rr - 1;
- printf("%d %4d", play[sqp->owner].num_rr, 25 << (play[sqp->owner].num_rr - 1));
+ printf("%d %4d", play[sqp->owner].num_rr,
+ 25 << (play[sqp->owner].num_rr - 1));
break;
}
if (eoln)
putchar('\n');
}
+
/*
* This routine prints out the mortgage flag.
*/
static void
printmorg(sqp)
-SQUARE *sqp;
+ SQUARE *sqp;
{
-
if (sqp->desc->morg)
printf(" * ");
else
printf(" ");
}
+
/*
* This routine lists the holdings of the player given
*/
void
printhold(pl)
-int pl;
+ int pl;
{
-
- OWN *op;
- PLAY *pp;
+ OWN *op;
+ PLAY *pp;
pp = &play[pl];
- printf("%s's (%d) holdings (Total worth: $%d):\n", name_list[pl], pl+1,
- pp->money + prop_worth(pp));
+ printf("%s's (%d) holdings (Total worth: $%d):\n", name_list[pl],
+ pl + 1, pp->money + prop_worth(pp));
printf("\t$%d", pp->money);
if (pp->num_gojf) {
printf(", %d get-out-of-jail-free card", pp->num_gojf);
diff --git a/monop/prop.c b/monop/prop.c
index cf853189..aec1f76a 100644
--- a/monop/prop.c
+++ b/monop/prop.c
@@ -1,4 +1,4 @@
-/* $NetBSD: prop.c,v 1.4 1997/10/12 17:45:23 christos Exp $ */
+/* $NetBSD: prop.c,v 1.5 1999/08/21 10:40:04 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)prop.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: prop.c,v 1.4 1997/10/12 17:45:23 christos Exp $");
+__RCSID("$NetBSD: prop.c,v 1.5 1999/08/21 10:40:04 simonb Exp $");
#endif
#endif /* not lint */
@@ -53,27 +53,26 @@ static int value __P((SQUARE *));
*/
void
buy(player, sqrp)
-int player;
-SQUARE *sqrp;
+ int player;
+ SQUARE *sqrp;
{
-
trading = FALSE;
sqrp->owner = player;
add_list(player, &(play[player].own_list), cur_p->loc);
}
+
/*
* This routine adds an item to the list.
*/
void
add_list(plr, head, op_sqr)
-int plr;
-OWN **head;
-int op_sqr;
+ int plr;
+ OWN **head;
+ int op_sqr;
{
-
- int val;
- OWN *tp, *last_tp;
- OWN *op;
+ int val;
+ OWN *tp, *last_tp;
+ OWN *op;
op = (OWN *)calloc(1, sizeof (OWN));
op->sqr = &board[op_sqr];
@@ -94,17 +93,17 @@ int op_sqr;
if (!trading)
set_ownlist(plr);
}
+
/*
* This routine deletes property from the list.
*/
void
del_list(plr, head, op_sqr)
-int plr;
-OWN **head;
-short op_sqr;
+ int plr;
+ OWN **head;
+ short op_sqr;
{
-
- OWN *op, *last_op;
+ OWN *op, *last_op;
switch (board[op_sqr].type) {
case PRPTY:
@@ -130,16 +129,16 @@ short op_sqr;
free(op);
}
}
+
/*
* This routine calculates the value for sorting of the
* given square.
*/
static int
value(sqp)
-SQUARE *sqp;
+ SQUARE *sqp;
{
-
- int sqr;
+ int sqr;
sqr = sqnum(sqp);
switch (sqp->type) {
@@ -158,6 +157,7 @@ SQUARE *sqp;
return 8 + (sqp->desc) - prop;
}
}
+
/*
* This routine accepts bids for the current peice
* of property.
@@ -165,11 +165,10 @@ SQUARE *sqp;
void
bid()
{
-
- static bool in[MAX_PL];
- int i, num_in, cur_max;
- char buf[80];
- int cur_bid;
+ static bool in[MAX_PL];
+ int i, num_in, cur_max;
+ char buf[80];
+ int cur_bid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0; i < num_play; i++)
@@ -189,7 +188,8 @@ bid()
break;
}
else if (cur_bid <= cur_max) {
- printf("You must bid higher than %d to stay in\n", cur_max);
+ printf("You must bid higher than %d "
+ "to stay in\n", cur_max);
printf("(bid of 0 drops you out)\n");
}
} while (cur_bid != 0 && cur_bid <= cur_max);
@@ -204,19 +204,20 @@ bid()
play[i].money -= cur_max;
}
else
- printf("Nobody seems to want it, so we'll leave it for later\n");
+ printf("Nobody seems to want it, so we'll leave it for "
+ "later\n");
}
+
/*
* This routine calculates the value of the property
* of given player.
*/
int
prop_worth(plp)
-PLAY *plp;
+ PLAY *plp;
{
-
- OWN *op;
- int worth;
+ OWN *op;
+ int worth;
worth = 0;
for (op = plp->own_list; op; op = op->next) {
diff --git a/monop/rent.c b/monop/rent.c
index 0269d170..c7b0cc9a 100644
--- a/monop/rent.c
+++ b/monop/rent.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rent.c,v 1.4 1997/10/12 17:45:24 christos Exp $ */
+/* $NetBSD: rent.c,v 1.5 1999/08/21 10:40:04 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,23 +38,22 @@
#if 0
static char sccsid[] = "@(#)rent.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: rent.c,v 1.4 1997/10/12 17:45:24 christos Exp $");
+__RCSID("$NetBSD: rent.c,v 1.5 1999/08/21 10:40:04 simonb Exp $");
#endif
#endif /* not lint */
-#include "monop.ext"
+#include "monop.ext"
/*
* This routine has the player pay rent
*/
void
rent(sqp)
-SQUARE *sqp;
+ SQUARE *sqp;
{
-
- int rnt = 0;
- PROP *pp;
- PLAY *plp;
+ int rnt = 0;
+ PROP *pp;
+ PLAY *plp;
plp = &play[sqp->owner];
printf("Owned by %s\n", plp->name);
diff --git a/monop/roll.c b/monop/roll.c
index a0e9e1c8..b8210d4c 100644
--- a/monop/roll.c
+++ b/monop/roll.c
@@ -1,4 +1,4 @@
-/* $NetBSD: roll.c,v 1.6 1997/10/12 17:45:25 christos Exp $ */
+/* $NetBSD: roll.c,v 1.7 1999/08/21 10:40:04 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)roll.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: roll.c,v 1.6 1997/10/12 17:45:25 christos Exp $");
+__RCSID("$NetBSD: roll.c,v 1.7 1999/08/21 10:40:04 simonb Exp $");
#endif
#endif /* not lint */
@@ -49,18 +49,17 @@ __RCSID("$NetBSD: roll.c,v 1.6 1997/10/12 17:45:25 christos Exp $");
* This routine rolls ndie nside-sided dice.
*/
-# define reg register
+#define reg register
-# if defined(pdp11)
-# define MAXRAND 32767L
+#if defined(pdp11)
+#define MAXRAND 32767L
int
roll(ndie, nsides)
-int ndie, nsides;
+ int ndie, nsides;
{
-
- long tot;
- unsigned n, r;
+ long tot;
+ unsigned n, r;
tot = 0;
n = ndie;
@@ -69,14 +68,14 @@ int ndie, nsides;
return (int) ((tot * (long) nsides) / ((long) MAXRAND + 1)) + ndie;
}
-# else
+#else
int
roll(ndie, nsides)
-int ndie, nsides; {
-
- int tot, r;
- double num_sides;
+ int ndie, nsides;
+{
+ int tot, r;
+ double num_sides;
num_sides = nsides;
tot = 0;
@@ -84,4 +83,4 @@ int ndie, nsides; {
tot += (r = rand()) * (num_sides / RAND_MAX) + 1;
return tot;
}
-# endif
+#endif
diff --git a/monop/spec.c b/monop/spec.c
index b5f68395..37d04271 100644
--- a/monop/spec.c
+++ b/monop/spec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spec.c,v 1.4 1997/10/12 17:45:26 christos Exp $ */
+/* $NetBSD: spec.c,v 1.5 1999/08/21 10:40:04 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,11 +38,11 @@
#if 0
static char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: spec.c,v 1.4 1997/10/12 17:45:26 christos Exp $");
+__RCSID("$NetBSD: spec.c,v 1.5 1999/08/21 10:40:04 simonb Exp $");
#endif
#endif /* not lint */
-# include "monop.ext"
+#include "monop.ext"
static char *perc[] = {
"10%", "ten percent", "%", "$200", "200", 0
@@ -51,10 +51,10 @@ static char *perc[] = {
void
inc_tax()
{ /* collect income tax */
+ int worth, com_num;
- int worth, com_num;
-
- com_num = getinp("Do you wish to lose 10%% of your total worth or $200? ", perc);
+ com_num = getinp("Do you wish to lose 10%% of your total worth or "
+ "$200? ", perc);
worth = cur_p->money + prop_worth(cur_p);
printf("You were worth $%d", worth);
worth /= 10;
@@ -80,14 +80,12 @@ inc_tax()
void
goto_jail()
{ /* move player to jail */
-
cur_p->loc = JAIL;
}
void
lux_tax()
{ /* landing on luxury tax */
-
printf("You lose $75\n");
cur_p->money -= 75;
}
@@ -95,13 +93,11 @@ lux_tax()
void
cc()
{ /* draw community chest card */
-
get_card(&CC_D);
}
void
chance()
{ /* draw chance card */
-
get_card(&CH_D);
}
diff --git a/monop/trade.c b/monop/trade.c
index 1a0b8fbc..322d880b 100644
--- a/monop/trade.c
+++ b/monop/trade.c
@@ -1,4 +1,4 @@
-/* $NetBSD: trade.c,v 1.4 1997/10/12 17:45:27 christos Exp $ */
+/* $NetBSD: trade.c,v 1.5 1999/08/21 10:40:04 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)trade.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: trade.c,v 1.4 1997/10/12 17:45:27 christos Exp $");
+__RCSID("$NetBSD: trade.c,v 1.5 1999/08/21 10:40:04 simonb Exp $");
#endif
#endif /* not lint */
@@ -68,8 +68,7 @@ static void move_em __P((TRADE *, TRADE *));
void
trade()
{
-
- int tradee, i;
+ int tradee, i;
trading = TRUE;
for (i = 0; i < 2; i++) {
@@ -101,20 +100,20 @@ over:
if (getyn("Is the trade ok? ") == 0)
do_trade();
}
+
/*
* This routine gets the list of things to be trader for the
* player, and puts in the structure given.
*/
static void
get_list(struct_no, play_no)
-int struct_no, play_no;
+ int struct_no, play_no;
{
-
- int sn, pn;
- PLAY *pp;
- int numin, prop, num_prp;
- OWN *op;
- TRADE *tp;
+ int sn, pn;
+ PLAY *pp;
+ int numin, prop, num_prp;
+ OWN *op;
+ TRADE *tp;
for (numin = 0; numin < MAX_PRP; numin++)
used[numin] = FALSE;
@@ -155,16 +154,16 @@ once_more:
}
}
}
+
/*
* This routine sets up the list of tradable property.
*/
static int
set_list(the_list)
-OWN *the_list;
+ OWN *the_list;
{
-
- int i;
- OWN *op;
+ int i;
+ OWN *op;
i = 0;
for (op = the_list; op; op = op->next)
@@ -174,17 +173,17 @@ OWN *the_list;
plist[i--] = 0;
return i;
}
+
/*
* This routine summates the trade.
*/
static void
summate()
{
-
- bool some;
- int i;
- TRADE *tp;
- OWN *op;
+ bool some;
+ int i;
+ TRADE *tp;
+ OWN *op;
for (i = 0; i < 2; i++) {
tp = &trades[i];
@@ -205,26 +204,26 @@ summate()
printf("\t-- Nothing --\n");
}
}
+
/*
* This routine actually executes the trade.
*/
static void
do_trade()
{
-
move_em(&trades[0], &trades[1]);
move_em(&trades[1], &trades[0]);
}
+
/*
* This routine does a switch from one player to another
*/
static void
move_em(from, to)
-TRADE *from, *to;
+ TRADE *from, *to;
{
-
- PLAY *pl_fr, *pl_to;
- OWN *op;
+ PLAY *pl_fr, *pl_to;
+ OWN *op;
pl_fr = &play[from->trader];
pl_to = &play[to->trader];
@@ -240,16 +239,16 @@ TRADE *from, *to;
}
set_ownlist(to->trader);
}
+
/*
* This routine lets a player resign
*/
void
resign()
{
-
- int i, new_own;
- OWN *op;
- SQUARE *sqp;
+ int i, new_own;
+ OWN *op;
+ SQUARE *sqp;
if (cur_p->money <= 0) {
switch (board[cur_p->loc].type) {