Convert to something resembling KNF.

This commit is contained in:
simonb 1999-08-21 10:40:03 +00:00
parent e28c422151
commit e42b2048d4
18 changed files with 375 additions and 369 deletions

View File

@ -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,7 +38,7 @@
#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 */
@ -90,13 +90,14 @@ 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; {
DECK *dp;
{
int r1, r2;
int i;
@ -121,6 +122,7 @@ DECK *dp; {
dp->offsets[r1] = temp;
}
}
/*
* This routine draws a card from the given deck
*/
@ -128,7 +130,6 @@ void
get_card(dp)
DECK *dp;
{
char type_maj, type_min;
int num;
int i, per_h, per_H, num_h, num_H;
@ -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,8 +230,8 @@ DECK *dp;
* This routine prints out the message on the card
*/
static void
printmes() {
printmes()
{
char c;
printline();

View File

@ -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

View File

@ -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 */
@ -68,7 +68,6 @@ void
execute(com_num)
int com_num;
{
new_play = FALSE; /* new_play is true if fixing */
(*func[com_num])();
notify();
@ -78,13 +77,13 @@ 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;
@ -111,6 +110,7 @@ do_move()
ret:
return;
}
/*
* This routine moves a normal move
*/
@ -118,7 +118,6 @@ void
move(rl)
int rl;
{
int old_loc;
old_loc = cur_p->loc;
@ -129,13 +128,13 @@ int rl;
}
show_move();
}
/*
* This routine shows the results of a move
*/
static void
show_move()
{
SQUARE *sqp;
sqp = &board[cur_p->loc];
@ -172,13 +171,13 @@ 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;
@ -219,13 +218,13 @@ save()
close(outf);
printf("[%s]\n", buf);
}
/*
* This routine restores an old game from a file
*/
void
restore()
{
char *sp;
printf("Which file do you wish to restore from? ");
@ -234,6 +233,7 @@ restore()
*sp = '\0';
rest_f(buf);
}
/*
* This does the actual restoring. It returns TRUE if the
* backup was successful, else false.
@ -242,7 +242,6 @@ int
rest_f(file)
char *file;
{
char *sp;
int inf, num;
char buf[80];

View File

@ -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 */
@ -57,7 +57,6 @@ int
getinp(prompt, list)
char *prompt, *list[];
{
int i, n_match, match = 0;
char *sp;
int c;
@ -106,7 +105,8 @@ 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);
}
}
@ -114,7 +114,6 @@ static int
comp(s1)
char *s1;
{
char *sp, *tsp, c;
if (buf[0] != '\0')

View File

@ -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,7 +58,6 @@ static void list_cur __P((MON *));
void
buy_houses()
{
int num_mon;
MON *mp;
OWN *op;
@ -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;
@ -114,7 +115,6 @@ static void
buy_h(mnp)
MON *mnp;
{
int i;
MON *mp;
int price;
@ -172,7 +172,6 @@ err: printf("That makes the spread too wide. Try again\n");
void
sell_houses()
{
int num_mon;
MON *mp;
OWN *op;
@ -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();
@ -217,7 +218,6 @@ static void
sell_h(mnp)
MON *mnp;
{
int i;
MON *mp;
int price;
@ -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;
}
}
@ -274,7 +276,6 @@ static void
list_cur(mp)
MON *mp;
{
int i;
SQUARE *sqp;

View File

@ -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 */
@ -68,7 +68,6 @@ __RCSID("$NetBSD: initdeck.c,v 1.6 1999/08/21 09:23:44 simonb Exp $");
#define FALSE 0
#define bool char
# define reg register
char *infile = "cards.inp", /* input file */
*outfile = "cards.pck"; /* "packed" file */
@ -86,8 +85,8 @@ static void putem __P((void));
int
main(ac, av)
int ac;
char *av[]; {
char *av[];
{
int i;
int32_t nc;
@ -142,7 +141,8 @@ 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);
}
@ -151,7 +151,6 @@ getargs(ac, 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;

View File

@ -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,6 +63,7 @@ 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.
@ -72,20 +72,19 @@ void
ret_card(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,6 +94,7 @@ pay()
cur_p->in_jail = 0;
printf("That cost you $50\n");
}
/*
* This routine deals with a move in jail
*/
@ -102,11 +102,11 @@ int
move_jail(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 ");

View File

@ -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,7 +38,7 @@
#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 */
@ -54,7 +54,6 @@ int
getyn(prompt)
char *prompt;
{
int com;
for (;;)
@ -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,17 +78,18 @@ 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.
@ -98,7 +98,6 @@ int
get_int(prompt)
char *prompt;
{
int num;
char *sp;
int c;
@ -124,6 +123,7 @@ inter:
printf("I can't understand that\n");
}
}
/*
* This routine sets the monopoly flag from the list given.
*/
@ -131,7 +131,6 @@ void
set_ownlist(pl)
int pl;
{
int num; /* general counter */
MON *orig; /* remember starting monop ptr */
OWN *op; /* current owned prop */
@ -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,6 +228,7 @@ int pl;
}
}
}
/*
* This routine sets things up as if it is a new monopoly
*/
@ -229,7 +237,6 @@ is_monop(mp, pl)
MON *mp;
int pl;
{
int i;
mp->owner = pl;
@ -238,6 +245,7 @@ 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
*/
@ -245,7 +253,6 @@ void
isnot_monop(mp)
MON *mp;
{
int i;
mp->owner = -1;
@ -253,34 +260,35 @@ MON *mp;
mp->sq[i]->desc->monop = FALSE;
mp->name = mp->not_m;
}
/*
* This routine gives a list of the current player's routine
*/
void
list()
{
printhold(player);
}
/*
* This routine gives a list of a given players holdings
*/
void
list_all()
{
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);

View File

@ -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 */
@ -65,9 +65,8 @@ static void do_quit __P((int));
int
main(ac, av)
int ac;
char *av[]; {
char *av[];
{
srand(getpid());
if (ac > 1) {
if (!rest_f(av[1]))
@ -97,13 +96,13 @@ do_quit(n)
{
quit();
}
/*
* This routine gets the names of the players
*/
static void
getplayers()
{
char *sp;
int i, j;
char buf[257];
@ -134,22 +133,25 @@ 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;
@ -175,13 +177,13 @@ 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;

View File

@ -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

View File

@ -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

View File

@ -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,7 +38,7 @@
#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 */
@ -87,19 +87,21 @@ static void fix_ex __P((int));
void
mortgage()
{
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,13 +113,13 @@ mortgage()
notify();
}
}
/*
* This routine sets up the list of mortgageable property
*/
static int
set_mlist()
{
OWN *op;
num_good = 0;
@ -134,6 +136,7 @@ set_mlist()
names[num_good--] = 0;
return num_good;
}
/*
* This routine actually mortgages the property.
*/
@ -141,7 +144,6 @@ static void
m(prop)
int prop;
{
int price;
price = board[prop].cost/2;
@ -149,6 +151,7 @@ int prop;
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,7 +160,6 @@ int prop;
void
unmortgage()
{
int prop;
for (;;) {
@ -171,19 +173,20 @@ 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;
num_good = 0;
@ -196,6 +199,7 @@ set_umlist()
names[num_good--] = 0;
return num_good;
}
/*
* This routine actually unmortgages the property
*/
@ -203,7 +207,6 @@ static void
unm(prop)
int prop;
{
int price;
price = board[prop].cost/2;
@ -213,6 +216,7 @@ int prop;
cur_p->money -= price;
set_umlist();
}
/*
* This routine forces the indebted player to fix his
* financial woes.
@ -220,12 +224,12 @@ 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
*/
@ -233,7 +237,6 @@ static void
fix_ex(com_num)
int com_num;
{
told_em = FALSE;
(*func[com_num])();
notify();

View File

@ -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,7 +38,7 @@
#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 */
@ -54,7 +54,6 @@ static void printmorg __P((SQUARE *));
void
printboard()
{
int i;
printf("%s\t%s\n", header, header);
@ -64,13 +63,13 @@ printboard()
printsq(i+N_SQRS/2, TRUE);
}
}
/*
* This routine lists where each player is.
*/
void
where()
{
int i;
printf("%s Player\n", header);
@ -82,6 +81,7 @@ where()
putchar('\n');
}
}
/*
* This routine prints out an individual square
*/
@ -90,7 +90,6 @@ printsq(sqn, eoln)
int sqn;
bool eoln;
{
int rnt;
PROP *pp;
SQUARE *sqp;
@ -156,12 +155,14 @@ 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.
*/
@ -169,12 +170,12 @@ static void
printmorg(sqp)
SQUARE *sqp;
{
if (sqp->desc->morg)
printf(" * ");
else
printf(" ");
}
/*
* This routine lists the holdings of the player given
*/
@ -182,13 +183,12 @@ void
printhold(pl)
int pl;
{
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);

View File

@ -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 */
@ -56,11 +56,11 @@ buy(player, 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.
*/
@ -70,7 +70,6 @@ int plr;
OWN **head;
int op_sqr;
{
int val;
OWN *tp, *last_tp;
OWN *op;
@ -94,6 +93,7 @@ int op_sqr;
if (!trading)
set_ownlist(plr);
}
/*
* This routine deletes property from the list.
*/
@ -103,7 +103,6 @@ int plr;
OWN **head;
short op_sqr;
{
OWN *op, *last_op;
switch (board[op_sqr].type) {
@ -130,6 +129,7 @@ short op_sqr;
free(op);
}
}
/*
* This routine calculates the value for sorting of the
* given square.
@ -138,7 +138,6 @@ static int
value(sqp)
SQUARE *sqp;
{
int sqr;
sqr = sqnum(sqp);
@ -158,6 +157,7 @@ SQUARE *sqp;
return 8 + (sqp->desc) - prop;
}
}
/*
* This routine accepts bids for the current peice
* of property.
@ -165,7 +165,6 @@ SQUARE *sqp;
void
bid()
{
static bool in[MAX_PL];
int i, num_in, cur_max;
char buf[80];
@ -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,8 +204,10 @@ 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.
@ -214,7 +216,6 @@ int
prop_worth(plp)
PLAY *plp;
{
OWN *op;
int worth;

View File

@ -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,7 +38,7 @@
#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 */
@ -51,7 +51,6 @@ void
rent(sqp)
SQUARE *sqp;
{
int rnt = 0;
PROP *pp;
PLAY *plp;

View File

@ -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 */
@ -58,7 +58,6 @@ int
roll(ndie, nsides)
int ndie, nsides;
{
long tot;
unsigned n, r;
@ -73,8 +72,8 @@ int ndie, nsides;
int
roll(ndie, nsides)
int ndie, nsides; {
int ndie, nsides;
{
int tot, r;
double num_sides;

View File

@ -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,7 +38,7 @@
#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 */
@ -51,10 +51,10 @@ static char *perc[] = {
void
inc_tax()
{ /* collect income tax */
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);
}

View File

@ -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,7 +68,6 @@ static void move_em __P((TRADE *, TRADE *));
void
trade()
{
int tradee, i;
trading = TRUE;
@ -101,6 +100,7 @@ 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.
@ -109,7 +109,6 @@ static void
get_list(struct_no, play_no)
int struct_no, play_no;
{
int sn, pn;
PLAY *pp;
int numin, prop, num_prp;
@ -155,6 +154,7 @@ once_more:
}
}
}
/*
* This routine sets up the list of tradable property.
*/
@ -162,7 +162,6 @@ static int
set_list(the_list)
OWN *the_list;
{
int i;
OWN *op;
@ -174,13 +173,13 @@ OWN *the_list;
plist[i--] = 0;
return i;
}
/*
* This routine summates the trade.
*/
static void
summate()
{
bool some;
int i;
TRADE *tp;
@ -205,16 +204,17 @@ 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
*/
@ -222,7 +222,6 @@ static void
move_em(from, to)
TRADE *from, *to;
{
PLAY *pl_fr, *pl_to;
OWN *op;
@ -240,13 +239,13 @@ TRADE *from, *to;
}
set_ownlist(to->trader);
}
/*
* This routine lets a player resign
*/
void
resign()
{
int i, new_own;
OWN *op;
SQUARE *sqp;