diff options
author | dholland <dholland@NetBSD.org> | 2008-02-24 01:57:34 +0000 |
---|---|---|
committer | dholland <dholland@NetBSD.org> | 2008-02-24 01:57:34 +0000 |
commit | 858a6720891a7ac54475ce092705f4a9c8ec4f64 (patch) | |
tree | 27f3c452f1e773e77d87905a6bd97ed192dc916e /monop | |
parent | 3a7bd350ec2aed9c0128fa818be32f554dfe29a6 (diff) | |
download | bsdgames-darwin-858a6720891a7ac54475ce092705f4a9c8ec4f64.tar.gz bsdgames-darwin-858a6720891a7ac54475ce092705f4a9c8ec4f64.tar.zst bsdgames-darwin-858a6720891a7ac54475ce092705f4a9c8ec4f64.zip |
Source files should be named *.c or *.h, not random other things.
Fold monop.ext (which was extern data decls) into monop.h and deck.h.
Fold monop.def (which had definitions for the extern data) into monop.c.
Fold brd.dat/mon.dat/prop.dat (which were array initializers for some of
the data) into monop.c.
Rearrange includes accordingly. No functional change.
Diffstat (limited to 'monop')
-rw-r--r-- | monop/brd.dat | 76 | ||||
-rw-r--r-- | monop/cards.c | 7 | ||||
-rw-r--r-- | monop/deck.h | 9 | ||||
-rw-r--r-- | monop/execute.c | 8 | ||||
-rw-r--r-- | monop/getinp.c | 7 | ||||
-rw-r--r-- | monop/houses.c | 6 | ||||
-rw-r--r-- | monop/jail.c | 6 | ||||
-rw-r--r-- | monop/misc.c | 7 | ||||
-rw-r--r-- | monop/mon.dat | 48 | ||||
-rw-r--r-- | monop/monop.c | 169 | ||||
-rw-r--r-- | monop/monop.def | 118 | ||||
-rw-r--r-- | monop/monop.ext | 57 | ||||
-rw-r--r-- | monop/monop.h | 24 | ||||
-rw-r--r-- | monop/morg.c | 6 | ||||
-rw-r--r-- | monop/print.c | 6 | ||||
-rw-r--r-- | monop/prop.c | 7 | ||||
-rw-r--r-- | monop/prop.dat | 56 | ||||
-rw-r--r-- | monop/rent.c | 6 | ||||
-rw-r--r-- | monop/roll.c | 7 | ||||
-rw-r--r-- | monop/spec.c | 7 | ||||
-rw-r--r-- | monop/trade.c | 6 |
21 files changed, 241 insertions, 402 deletions
diff --git a/monop/brd.dat b/monop/brd.dat deleted file mode 100644 index bbfc1363..00000000 --- a/monop/brd.dat +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: brd.dat,v 1.5 2008/02/19 09:28:05 dholland Exp $ */ - -/*- - * 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 - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)brd.dat 5.5 (Berkeley) 5/31/93 - */ - -/* name (COLOR) owner type desc cost */ - -{"=== GO ===", -1, SAFE, NULL, 0 }, -{"Mediterranean Ave. (P)", -1, PRPTY, &prop[0], 60 }, -{"Community Chest i", -1, CC, NULL, 0 }, -{"Baltic Ave. (P)", -1, PRPTY, &prop[1], 60 }, -{"Income Tax", -1, INC_TAX, NULL, 0 }, -{"Reading RR", -1, RR, &rr[0], 200 }, -{"Oriental Ave. (L)", -1, PRPTY, &prop[2], 100 }, -{"Chance i", -1, CHANCE, NULL, 0 }, -{"Vermont Ave. (L)", -1, PRPTY, &prop[3], 100 }, -{"Connecticut Ave. (L)", -1, PRPTY, &prop[4], 120 }, -{"Just Visiting", -1, SAFE, NULL, 0 }, -{"St. Charles Pl. (V)", -1, PRPTY, &prop[5], 140 }, -{"Electric Co.", -1, UTIL, &util[0], 150 }, -{"States Ave. (V)", -1, PRPTY, &prop[6], 140 }, -{"Virginia Ave. (V)", -1, PRPTY, &prop[7], 160 }, -{"Pennsylvania RR", -1, RR, &rr[1], 200 }, -{"St. James Pl. (O)", -1, PRPTY, &prop[8], 180 }, -{"Community Chest ii", -1, CC, NULL, 0 }, -{"Tennessee Ave. (O)", -1, PRPTY, &prop[9], 180 }, -{"New York Ave. (O)", -1, PRPTY, &prop[10], 200 }, -{"Free Parking", -1, SAFE, NULL, 0 }, -{"Kentucky Ave. (R)", -1, PRPTY, &prop[11], 220 }, -{"Chance ii", -1, CHANCE, NULL, 0 }, -{"Indiana Ave. (R)", -1, PRPTY, &prop[12], 220 }, -{"Illinois Ave. (R)", -1, PRPTY, &prop[13], 240 }, -{"B&O RR", -1, RR, &rr[2], 200 }, -{"Atlantic Ave. (Y)", -1, PRPTY, &prop[14], 260 }, -{"Ventnor Ave. (Y)", -1, PRPTY, &prop[15], 260 }, -{"Water Works", -1, UTIL, &util[1], 150 }, -{"Marvin Gardens (Y)", -1, PRPTY, &prop[16], 280 }, -{"GO TO JAIL", -1, GOTO_J, NULL, 0 }, -{"Pacific Ave. (G)", -1, PRPTY, &prop[17], 300 }, -{"N. Carolina Ave. (G)", -1, PRPTY, &prop[18], 300 }, -{"Community Chest iii", -1, CC, NULL, 0 }, -{"Pennsylvania Ave. (G)", -1, PRPTY, &prop[19], 320 }, -{"Short Line RR", -1, RR, &rr[3], 200 }, -{"Chance iii", -1, CHANCE, NULL, 0 }, -{"Park Place (D)", -1, PRPTY, &prop[20], 350 }, -{"Luxury Tax", -1, LUX_TAX, NULL, 0 }, -{"Boardwalk (D)", -1, PRPTY, &prop[21], 400 }, -{"JAIL", -1, IN_JAIL, NULL, 0 } diff --git a/monop/cards.c b/monop/cards.c index ca27b463..a085412b 100644 --- a/monop/cards.c +++ b/monop/cards.c @@ -1,4 +1,4 @@ -/* $NetBSD: cards.c,v 1.20 2008/02/23 19:54:06 dholland Exp $ */ +/* $NetBSD: cards.c,v 1.21 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,13 +34,14 @@ #if 0 static char sccsid[] = "@(#)cards.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: cards.c,v 1.20 2008/02/23 19:54:06 dholland Exp $"); +__RCSID("$NetBSD: cards.c,v 1.21 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ #include <sys/types.h> #include <sys/endian.h> -#include "monop.ext" +#include "monop.h" +#include "deck.h" #include "pathnames.h" /* diff --git a/monop/deck.h b/monop/deck.h index 93b9c0bb..7275d1cc 100644 --- a/monop/deck.h +++ b/monop/deck.h @@ -1,4 +1,4 @@ -/* $NetBSD: deck.h,v 1.7 2008/02/23 19:49:21 dholland Exp $ */ +/* $NetBSD: deck.h,v 1.8 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -46,3 +46,10 @@ struct dk_st { /* deck description structure */ }; typedef struct dk_st DECK; + +extern DECK deck[2]; + +/* cards.c */ +void init_decks(void); +void get_card(DECK *); + diff --git a/monop/execute.c b/monop/execute.c index 29354a76..0f7036a6 100644 --- a/monop/execute.c +++ b/monop/execute.c @@ -1,4 +1,4 @@ -/* $NetBSD: execute.c,v 1.16 2008/02/24 01:41:14 dholland Exp $ */ +/* $NetBSD: execute.c,v 1.17 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,11 +34,10 @@ #if 0 static char sccsid[] = "@(#)execute.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: execute.c,v 1.16 2008/02/24 01:41:14 dholland Exp $"); +__RCSID("$NetBSD: execute.c,v 1.17 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ -#include "monop.ext" #include <fcntl.h> #include <stdlib.h> #include <unistd.h> @@ -49,6 +48,9 @@ __RCSID("$NetBSD: execute.c,v 1.16 2008/02/24 01:41:14 dholland Exp $"); #include <time.h> #include <errno.h> +#include "deck.h" +#include "monop.h" + #define MIN_FORMAT_VERSION 1 #define CUR_FORMAT_VERSION 1 #define MAX_FORMAT_VERSION 1 diff --git a/monop/getinp.c b/monop/getinp.c index 92546ac6..48730f77 100644 --- a/monop/getinp.c +++ b/monop/getinp.c @@ -1,4 +1,4 @@ -/* $NetBSD: getinp.c,v 1.17 2008/02/23 20:12:15 dholland Exp $ */ +/* $NetBSD: getinp.c,v 1.18 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,14 +34,15 @@ #if 0 static char sccsid[] = "@(#)getinp.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: getinp.c,v 1.17 2008/02/23 20:12:15 dholland Exp $"); +__RCSID("$NetBSD: getinp.c,v 1.18 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ #include <stdio.h> #include <string.h> #include <ctype.h> -#include "monop.ext" + +#include "monop.h" #define LINE 70 diff --git a/monop/houses.c b/monop/houses.c index d2a28b6d..0508a97e 100644 --- a/monop/houses.c +++ b/monop/houses.c @@ -1,4 +1,4 @@ -/* $NetBSD: houses.c,v 1.12 2008/02/23 21:07:52 dholland Exp $ */ +/* $NetBSD: houses.c,v 1.13 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,11 +34,11 @@ #if 0 static char sccsid[] = "@(#)houses.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: houses.c,v 1.12 2008/02/23 21:07:52 dholland Exp $"); +__RCSID("$NetBSD: houses.c,v 1.13 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ -#include "monop.ext" +#include "monop.h" static const char *names[N_MON+2]; static char cur_prop[80]; diff --git a/monop/jail.c b/monop/jail.c index f2599ccb..917b7a0a 100644 --- a/monop/jail.c +++ b/monop/jail.c @@ -1,4 +1,4 @@ -/* $NetBSD: jail.c,v 1.8 2008/02/23 19:09:00 dholland Exp $ */ +/* $NetBSD: jail.c,v 1.9 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,11 +34,11 @@ #if 0 static char sccsid[] = "@(#)jail.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: jail.c,v 1.8 2008/02/23 19:09:00 dholland Exp $"); +__RCSID("$NetBSD: jail.c,v 1.9 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ -#include "monop.ext" +#include "monop.h" /* * This routine uses a get-out-of-jail-free card to get the diff --git a/monop/misc.c b/monop/misc.c index 803c6e84..22ccce8a 100644 --- a/monop/misc.c +++ b/monop/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.18 2008/02/23 21:35:13 dholland Exp $ */ +/* $NetBSD: misc.c,v 1.19 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,15 +34,16 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: misc.c,v 1.18 2008/02/23 21:35:13 dholland Exp $"); +__RCSID("$NetBSD: misc.c,v 1.19 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ -#include "monop.ext" #include <ctype.h> #include <limits.h> #include <signal.h> +#include "monop.h" + /* * This routine executes a truncated set of commands until a * "yes or "no" answer is gotten. diff --git a/monop/mon.dat b/monop/mon.dat deleted file mode 100644 index 24a5a88f..00000000 --- a/monop/mon.dat +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: mon.dat,v 1.4 2008/01/28 06:16:13 dholland Exp $ */ - -/*- - * 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 - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mon.dat 5.4 (Berkeley) 5/31/93 - */ - -#define MONINIT(num_in, h_cost, not_m, mon_n, sq1,sq2,sq3) \ - {0, -1, num_in, 0, h_cost, not_m, mon_n, {sq1,sq2,sq3}, {0,0,0}} -/* name owner num_own sq */ - -/* num_in h_cost not_m mon_n sqnums */ -MONINIT(2, 1, "Purple", "PURPLE", 1,3, 0), -MONINIT(3, 1, "Lt. Blue", "LT. BLUE", 6,8,9), -MONINIT(3, 2, "Violet", "VIOLET", 11,13,14), -MONINIT(3, 2, "Orange", "ORANGE", 16,18,19), -MONINIT(3, 3, "Red", "RED", 21,23,24), -MONINIT(3, 3, "Yellow", "YELLOW", 26,27,29), -MONINIT(3, 4, "Green", "GREEN", 31,32,34), -MONINIT(2, 4, "Dk. Blue", "DK. BLUE", 37,39, 0), - -#undef MONINIT diff --git a/monop/monop.c b/monop/monop.c index bb89d41a..e50fdb7e 100644 --- a/monop/monop.c +++ b/monop/monop.c @@ -1,4 +1,4 @@ -/* $NetBSD: monop.c,v 1.20 2008/02/24 01:41:14 dholland Exp $ */ +/* $NetBSD: monop.c,v 1.21 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,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.20 2008/02/24 01:41:14 dholland Exp $"); +__RCSID("$NetBSD: monop.c,v 1.21 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ @@ -48,7 +48,8 @@ __RCSID("$NetBSD: monop.c,v 1.20 2008/02/24 01:41:14 dholland Exp $"); #include <stdlib.h> #include <time.h> #include <unistd.h> -#include "monop.def" +#include "deck.h" +#include "monop.h" int main(int, char *[]); static void getplayers(void); @@ -56,6 +57,168 @@ static void init_players(void); static void init_monops(void); static void do_quit(int); + +bool fixing, /* set if fixing up debt */ + trading, /* set if in process of trading */ + told_em, /* set if told user he's out of debt */ + spec; /* set if moving by card to RR or UTIL */ + +const char *name_list[MAX_PL+2], /* list of players' names */ + *const comlist[] = { /* list of normal commands */ + "quit", /* 0 */ "print", /* 1 */ + "where", /* 2 */ "own holdings", /* 3 */ + "holdings", /* 4 */ "mortgage", /* 5 */ + "unmortgage", /* 6 */ "buy houses", /* 7 */ + "sell houses", /* 8 */ "card", /* 9 */ + "pay", /* 10 */ "trade", /* 11 */ + "resign", /* 12 */ "save", /* 13 */ + "restore", /* 14 */ "roll", /* 15 */ + "", /* 16 */ + 0 + }, + *const yncoms[] = { /* list of commands for yes/no answers */ + "yes", /* 0 */ "no", /* 1 */ + "quit", /* 2 */ "print", /* 3 */ + "where", /* 4 */ "own holdings", /* 5 */ + "holdings", /* 6 */ + 0 + }, + *const lucky_mes[] = { /* "got lucky" messages */ + "You lucky stiff", "You got lucky", + "What a lucky person!", "You must have a 4-leaf clover", + "My, my! Aren't we lucky!", "Luck smiles upon you", + "You got lucky this time", "Lucky person!", + "Your karma must certainly be together", + "How beautifully Cosmic", "Wow, you must be really with it" + /* "I want your autograph", -- Save for later */ + }; + +int player, /* current player number */ + num_play, /* current number of players */ + num_doub, /* # of doubles current player rolled */ + /* # of "got lucky" messages */ + num_luck = sizeof lucky_mes / sizeof (char *); + +/* list of command functions */ +void (*const func[])(void) = { /* array of function calls for commands */ + quit, /* quit game |* 0 *| */ + printboard, /* print board |* 1 *| */ + where, /* where players are |* 2 *| */ + list, /* own holdings |* 3 *| */ + list_all, /* holdings list |* 4 *| */ + mortgage, /* mortgage property |* 5 *| */ + unmortgage, /* unmortgage property |* 6 *| */ + buy_houses, /* buy houses |* 7 *| */ + sell_houses, /* sell houses |* 8 *| */ + card, /* card for jail |* 9 *| */ + pay, /* pay for jail |* 10 *| */ + trade, /* trade |* 11 *| */ + resign, /* resign |* 12 *| */ + save, /* save game |* 13 *| */ + restore, /* restore game |* 14 *| */ + do_move, /* roll |* 15 *| */ + do_move /* "" |* 16 *| */ + }; + +DECK deck[2]; /* Chance and Community Chest */ + +PLAY *play, /* player structure array ("calloc"ed) */ + *cur_p; /* pointer to current player's struct */ + +RR_S rr[N_RR]; /* railroad descriptions */ + +UTIL_S util[2]; /* utility descriptions */ + +#define MONINIT(num_in, h_cost, not_m, mon_n, sq1,sq2,sq3) \ + {0, -1, num_in, 0, h_cost, not_m, mon_n, {sq1,sq2,sq3}, {0,0,0}} +/* name owner num_own sq */ + +MON mon[N_MON] = { /* monopoly descriptions */ +/* num_in h_cost not_m mon_n sqnums */ +MONINIT(2, 1, "Purple", "PURPLE", 1,3, 0), +MONINIT(3, 1, "Lt. Blue", "LT. BLUE", 6,8,9), +MONINIT(3, 2, "Violet", "VIOLET", 11,13,14), +MONINIT(3, 2, "Orange", "ORANGE", 16,18,19), +MONINIT(3, 3, "Red", "RED", 21,23,24), +MONINIT(3, 3, "Yellow", "YELLOW", 26,27,29), +MONINIT(3, 4, "Green", "GREEN", 31,32,34), +MONINIT(2, 4, "Dk. Blue", "DK. BLUE", 37,39, 0), +}; +#undef MONINIT + +PROP prop[N_PROP] = { /* typical properties */ +/* morg monop square houses mon_desc rent */ +{0, 0, 1, 0, &mon[0], { 2, 10, 30, 90, 160, 250} }, +{0, 0, 3, 0, &mon[0], { 4, 20, 60, 180, 320, 450} }, +{0, 0, 6, 0, &mon[1], { 6, 30, 90, 270, 400, 550} }, +{0, 0, 7, 0, &mon[1], { 6, 30, 90, 270, 400, 550} }, +{0, 0, 9, 0, &mon[1], { 8, 40,100, 300, 450, 600} }, +{0, 0, 11, 0, &mon[2], {10, 50,150, 450, 625, 750} }, +{0, 0, 13, 0, &mon[2], {10, 50,150, 450, 625, 750} }, +{0, 0, 14, 0, &mon[2], {12, 60,180, 500, 700, 900} }, +{0, 0, 16, 0, &mon[3], {14, 70,200, 550, 750, 950} }, +{0, 0, 17, 0, &mon[3], {14, 70,200, 550, 750, 950} }, +{0, 0, 19, 0, &mon[3], {16, 80,220, 600, 800,1000} }, +{0, 0, 21, 0, &mon[4], {18, 90,250, 700, 875,1050} }, +{0, 0, 23, 0, &mon[4], {18, 90,250, 700, 875,1050} }, +{0, 0, 24, 0, &mon[4], {20,100,300, 750, 925,1100} }, +{0, 0, 26, 0, &mon[5], {22,110,330, 800, 975,1150} }, +{0, 0, 27, 0, &mon[5], {22,110,330, 800, 975,1150} }, +{0, 0, 29, 0, &mon[5], {24,120,360, 850,1025,1200} }, +{0, 0, 31, 0, &mon[6], {26,130,390, 900,1100,1275} }, +{0, 0, 32, 0, &mon[6], {26,130,390, 900,1100,1275} }, +{0, 0, 34, 0, &mon[6], {28,150,450,1000,1200,1400} }, +{0, 0, 37, 0, &mon[7], {35,175,500,1100,1300,1500} }, +{0, 0, 39, 0, &mon[7], {50,200,600,1400,1700,2000} } +}; + +SQUARE board[N_SQRS+1] = { /* board itself (+1 for Jail) */ +/* name (COLOR) owner type desc cost */ + +{"=== GO ===", -1, SAFE, NULL, 0 }, +{"Mediterranean Ave. (P)", -1, PRPTY, &prop[0], 60 }, +{"Community Chest i", -1, CC, NULL, 0 }, +{"Baltic Ave. (P)", -1, PRPTY, &prop[1], 60 }, +{"Income Tax", -1, INC_TAX, NULL, 0 }, +{"Reading RR", -1, RR, &rr[0], 200 }, +{"Oriental Ave. (L)", -1, PRPTY, &prop[2], 100 }, +{"Chance i", -1, CHANCE, NULL, 0 }, +{"Vermont Ave. (L)", -1, PRPTY, &prop[3], 100 }, +{"Connecticut Ave. (L)", -1, PRPTY, &prop[4], 120 }, +{"Just Visiting", -1, SAFE, NULL, 0 }, +{"St. Charles Pl. (V)", -1, PRPTY, &prop[5], 140 }, +{"Electric Co.", -1, UTIL, &util[0], 150 }, +{"States Ave. (V)", -1, PRPTY, &prop[6], 140 }, +{"Virginia Ave. (V)", -1, PRPTY, &prop[7], 160 }, +{"Pennsylvania RR", -1, RR, &rr[1], 200 }, +{"St. James Pl. (O)", -1, PRPTY, &prop[8], 180 }, +{"Community Chest ii", -1, CC, NULL, 0 }, +{"Tennessee Ave. (O)", -1, PRPTY, &prop[9], 180 }, +{"New York Ave. (O)", -1, PRPTY, &prop[10], 200 }, +{"Free Parking", -1, SAFE, NULL, 0 }, +{"Kentucky Ave. (R)", -1, PRPTY, &prop[11], 220 }, +{"Chance ii", -1, CHANCE, NULL, 0 }, +{"Indiana Ave. (R)", -1, PRPTY, &prop[12], 220 }, +{"Illinois Ave. (R)", -1, PRPTY, &prop[13], 240 }, +{"B&O RR", -1, RR, &rr[2], 200 }, +{"Atlantic Ave. (Y)", -1, PRPTY, &prop[14], 260 }, +{"Ventnor Ave. (Y)", -1, PRPTY, &prop[15], 260 }, +{"Water Works", -1, UTIL, &util[1], 150 }, +{"Marvin Gardens (Y)", -1, PRPTY, &prop[16], 280 }, +{"GO TO JAIL", -1, GOTO_J, NULL, 0 }, +{"Pacific Ave. (G)", -1, PRPTY, &prop[17], 300 }, +{"N. Carolina Ave. (G)", -1, PRPTY, &prop[18], 300 }, +{"Community Chest iii", -1, CC, NULL, 0 }, +{"Pennsylvania Ave. (G)", -1, PRPTY, &prop[19], 320 }, +{"Short Line RR", -1, RR, &rr[3], 200 }, +{"Chance iii", -1, CHANCE, NULL, 0 }, +{"Park Place (D)", -1, PRPTY, &prop[20], 350 }, +{"Luxury Tax", -1, LUX_TAX, NULL, 0 }, +{"Boardwalk (D)", -1, PRPTY, &prop[21], 400 }, +{"JAIL", -1, IN_JAIL, NULL, 0 } +}; + + /* * This program implements a monopoly game */ diff --git a/monop/monop.def b/monop/monop.def deleted file mode 100644 index af7b3653..00000000 --- a/monop/monop.def +++ /dev/null @@ -1,118 +0,0 @@ -/* $NetBSD: monop.def,v 1.11 2008/02/20 05:08:46 dholland Exp $ */ - -/*- - * 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 - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)monop.def 5.5 (Berkeley) 5/31/93 - */ - -#include "deck.h" -#include "monop.h" - -bool fixing, /* set if fixing up debt */ - trading, /* set if in process of trading */ - told_em, /* set if told user he's out of debt */ - spec; /* set if moving by card to RR or UTIL */ - -const char *name_list[MAX_PL+2], /* list of players' names */ - *const comlist[] = { /* list of normal commands */ - "quit", /* 0 */ "print", /* 1 */ - "where", /* 2 */ "own holdings", /* 3 */ - "holdings", /* 4 */ "mortgage", /* 5 */ - "unmortgage", /* 6 */ "buy houses", /* 7 */ - "sell houses", /* 8 */ "card", /* 9 */ - "pay", /* 10 */ "trade", /* 11 */ - "resign", /* 12 */ "save", /* 13 */ - "restore", /* 14 */ "roll", /* 15 */ - "", /* 16 */ - 0 - }, - *const yncoms[] = { /* list of commands for yes/no answers */ - "yes", /* 0 */ "no", /* 1 */ - "quit", /* 2 */ "print", /* 3 */ - "where", /* 4 */ "own holdings", /* 5 */ - "holdings", /* 6 */ - 0 - }, - *const lucky_mes[] = { /* "got lucky" messages */ - "You lucky stiff", "You got lucky", - "What a lucky person!", "You must have a 4-leaf clover", - "My, my! Aren't we lucky!", "Luck smiles upon you", - "You got lucky this time", "Lucky person!", - "Your karma must certainly be together", - "How beautifully Cosmic", "Wow, you must be really with it" - /* "I want your autograph", -- Save for later */ - }; - -int player, /* current player number */ - num_play, /* current number of players */ - num_doub, /* # of doubles current player rolled */ - /* # of "got lucky" messages */ - num_luck = sizeof lucky_mes / sizeof (char *); - -/* list of command functions */ -void (*const func[])(void) = { /* array of function calls for commands */ - quit, /* quit game |* 0 *| */ - printboard, /* print board |* 1 *| */ - where, /* where players are |* 2 *| */ - list, /* own holdings |* 3 *| */ - list_all, /* holdings list |* 4 *| */ - mortgage, /* mortgage property |* 5 *| */ - unmortgage, /* unmortgage property |* 6 *| */ - buy_houses, /* buy houses |* 7 *| */ - sell_houses, /* sell houses |* 8 *| */ - card, /* card for jail |* 9 *| */ - pay, /* pay for jail |* 10 *| */ - trade, /* trade |* 11 *| */ - resign, /* resign |* 12 *| */ - save, /* save game |* 13 *| */ - restore, /* restore game |* 14 *| */ - do_move, /* roll |* 15 *| */ - do_move /* "" |* 16 *| */ - }; - -DECK deck[2]; /* Chance and Community Chest */ - -PLAY *play, /* player structure array ("calloc"ed) */ - *cur_p; /* pointer to current player's struct */ - -RR_S rr[N_RR]; /* railroad descriptions */ - -UTIL_S util[2]; /* utility descriptions */ - -MON mon[N_MON] = { /* monopoly descriptions */ -#include "mon.dat" -}; - -PROP prop[N_PROP] = { /* typical properties */ -#include "prop.dat" -}; - -SQUARE board[N_SQRS+1] = { /* board itself (+1 for Jail) */ -#include "brd.dat" -}; diff --git a/monop/monop.ext b/monop/monop.ext deleted file mode 100644 index 395a512e..00000000 --- a/monop/monop.ext +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: monop.ext,v 1.8 2008/02/20 04:50:12 dholland Exp $ */ - -/*- - * 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 - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)monop.ext 5.4 (Berkeley) 5/31/93 - */ - -#include "deck.h" -#include "monop.h" - -extern bool trading, spec, fixing, told_em; - -extern const char *const yncoms[], *const comlist[], *name_list[], *const lucky_mes[]; - -extern int num_play, player, num_doub, num_luck; - -extern void (*const func[])(void); - -extern DECK deck[2]; - -extern MON mon[N_MON]; - -extern PLAY *play, *cur_p; - -extern PROP prop[N_PROP]; - -extern RR_S rr[N_RR]; - -extern SQUARE board[N_SQRS + 1]; - -extern UTIL_S util[2]; diff --git a/monop/monop.h b/monop/monop.h index 9becc1f8..aee4394e 100644 --- a/monop/monop.h +++ b/monop/monop.h @@ -1,4 +1,4 @@ -/* $NetBSD: monop.h,v 1.15 2008/02/23 21:07:52 dholland Exp $ */ +/* $NetBSD: monop.h,v 1.16 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -129,10 +129,26 @@ typedef struct prp_st PROP; typedef struct prp_st RR_S; typedef struct prp_st UTIL_S; +extern bool trading, spec, fixing, told_em; + +extern const char *const yncoms[], *const comlist[], *name_list[], *const lucky_mes[]; + +extern int num_play, player, num_doub, num_luck; + +extern void (*const func[])(void); + +extern MON mon[N_MON]; + +extern PLAY *play, *cur_p; + +extern PROP prop[N_PROP]; + +extern RR_S rr[N_RR]; + +extern SQUARE board[N_SQRS + 1]; + +extern UTIL_S util[2]; -/* cards.c */ -void init_decks(void); -void get_card(DECK *); /* execute.c */ void execute(int); diff --git a/monop/morg.c b/monop/morg.c index de678776..d1bb5ba3 100644 --- a/monop/morg.c +++ b/monop/morg.c @@ -1,4 +1,4 @@ -/* $NetBSD: morg.c,v 1.15 2008/02/23 22:06:30 dholland Exp $ */ +/* $NetBSD: morg.c,v 1.16 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,11 +34,11 @@ #if 0 static char sccsid[] = "@(#)morg.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: morg.c,v 1.15 2008/02/23 22:06:30 dholland Exp $"); +__RCSID("$NetBSD: morg.c,v 1.16 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ -#include "monop.ext" +#include "monop.h" /* * These routines deal with mortgaging. diff --git a/monop/print.c b/monop/print.c index b97cf48e..f6bbcf29 100644 --- a/monop/print.c +++ b/monop/print.c @@ -1,4 +1,4 @@ -/* $NetBSD: print.c,v 1.10 2008/02/20 05:08:46 dholland Exp $ */ +/* $NetBSD: print.c,v 1.11 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,11 +34,11 @@ #if 0 static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: print.c,v 1.10 2008/02/20 05:08:46 dholland Exp $"); +__RCSID("$NetBSD: print.c,v 1.11 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ -#include "monop.ext" +#include "monop.h" static const char *header = "Name Own Price Mg # Rent"; diff --git a/monop/prop.c b/monop/prop.c index f85c87f9..a8950e29 100644 --- a/monop/prop.c +++ b/monop/prop.c @@ -1,4 +1,4 @@ -/* $NetBSD: prop.c,v 1.16 2008/02/23 22:17:02 dholland Exp $ */ +/* $NetBSD: prop.c,v 1.17 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,12 +34,13 @@ #if 0 static char sccsid[] = "@(#)prop.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: prop.c,v 1.16 2008/02/23 22:17:02 dholland Exp $"); +__RCSID("$NetBSD: prop.c,v 1.17 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ #include <stdlib.h> -#include "monop.ext" + +#include "monop.h" static int value(SQUARE *); diff --git a/monop/prop.dat b/monop/prop.dat deleted file mode 100644 index 126085da..00000000 --- a/monop/prop.dat +++ /dev/null @@ -1,56 +0,0 @@ -/* $NetBSD: prop.dat,v 1.3 2003/08/07 09:37:29 agc Exp $ */ - -/*- - * 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 - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)prop.dat 5.4 (Berkeley) 5/31/93 - */ - -/* morg monop square houses mon_desc rent */ -{0, 0, 1, 0, &mon[0], { 2, 10, 30, 90, 160, 250} }, -{0, 0, 3, 0, &mon[0], { 4, 20, 60, 180, 320, 450} }, -{0, 0, 6, 0, &mon[1], { 6, 30, 90, 270, 400, 550} }, -{0, 0, 7, 0, &mon[1], { 6, 30, 90, 270, 400, 550} }, -{0, 0, 9, 0, &mon[1], { 8, 40,100, 300, 450, 600} }, -{0, 0, 11, 0, &mon[2], {10, 50,150, 450, 625, 750} }, -{0, 0, 13, 0, &mon[2], {10, 50,150, 450, 625, 750} }, -{0, 0, 14, 0, &mon[2], {12, 60,180, 500, 700, 900} }, -{0, 0, 16, 0, &mon[3], {14, 70,200, 550, 750, 950} }, -{0, 0, 17, 0, &mon[3], {14, 70,200, 550, 750, 950} }, -{0, 0, 19, 0, &mon[3], {16, 80,220, 600, 800,1000} }, -{0, 0, 21, 0, &mon[4], {18, 90,250, 700, 875,1050} }, -{0, 0, 23, 0, &mon[4], {18, 90,250, 700, 875,1050} }, -{0, 0, 24, 0, &mon[4], {20,100,300, 750, 925,1100} }, -{0, 0, 26, 0, &mon[5], {22,110,330, 800, 975,1150} }, -{0, 0, 27, 0, &mon[5], {22,110,330, 800, 975,1150} }, -{0, 0, 29, 0, &mon[5], {24,120,360, 850,1025,1200} }, -{0, 0, 31, 0, &mon[6], {26,130,390, 900,1100,1275} }, -{0, 0, 32, 0, &mon[6], {26,130,390, 900,1100,1275} }, -{0, 0, 34, 0, &mon[6], {28,150,450,1000,1200,1400} }, -{0, 0, 37, 0, &mon[7], {35,175,500,1100,1300,1500} }, -{0, 0, 39, 0, &mon[7], {50,200,600,1400,1700,2000} } diff --git a/monop/rent.c b/monop/rent.c index 2061de5e..75ec0e09 100644 --- a/monop/rent.c +++ b/monop/rent.c @@ -1,4 +1,4 @@ -/* $NetBSD: rent.c,v 1.7 2008/02/23 22:20:35 dholland Exp $ */ +/* $NetBSD: rent.c,v 1.8 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,11 +34,11 @@ #if 0 static char sccsid[] = "@(#)rent.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: rent.c,v 1.7 2008/02/23 22:20:35 dholland Exp $"); +__RCSID("$NetBSD: rent.c,v 1.8 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ -#include "monop.ext" +#include "monop.h" /* * This routine has the player pay rent diff --git a/monop/roll.c b/monop/roll.c index b3e5a9d7..f5372c70 100644 --- a/monop/roll.c +++ b/monop/roll.c @@ -1,4 +1,4 @@ -/* $NetBSD: roll.c,v 1.10 2008/02/20 04:48:10 dholland Exp $ */ +/* $NetBSD: roll.c,v 1.11 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,13 +34,14 @@ #if 0 static char sccsid[] = "@(#)roll.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: roll.c,v 1.10 2008/02/20 04:48:10 dholland Exp $"); +__RCSID("$NetBSD: roll.c,v 1.11 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ -#include "monop.ext" #include <stdlib.h> +#include "monop.h" + /* * This routine rolls ndie nside-sided dice. */ diff --git a/monop/spec.c b/monop/spec.c index 692c745f..3ff323d9 100644 --- a/monop/spec.c +++ b/monop/spec.c @@ -1,4 +1,4 @@ -/* $NetBSD: spec.c,v 1.9 2008/02/19 10:47:40 dholland Exp $ */ +/* $NetBSD: spec.c,v 1.10 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,11 +34,12 @@ #if 0 static char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: spec.c,v 1.9 2008/02/19 10:47:40 dholland Exp $"); +__RCSID("$NetBSD: spec.c,v 1.10 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ -#include "monop.ext" +#include "monop.h" +#include "deck.h" static const char *const perc[] = { "10%", "ten percent", "%", "$200", "200", 0 diff --git a/monop/trade.c b/monop/trade.c index bfbfb6cd..0da50917 100644 --- a/monop/trade.c +++ b/monop/trade.c @@ -1,4 +1,4 @@ -/* $NetBSD: trade.c,v 1.14 2008/02/24 01:37:57 dholland Exp $ */ +/* $NetBSD: trade.c,v 1.15 2008/02/24 01:57:34 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,11 +34,11 @@ #if 0 static char sccsid[] = "@(#)trade.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: trade.c,v 1.14 2008/02/24 01:37:57 dholland Exp $"); +__RCSID("$NetBSD: trade.c,v 1.15 2008/02/24 01:57:34 dholland Exp $"); #endif #endif /* not lint */ -#include "monop.ext" +#include "monop.h" struct trd_st { /* how much to give to other player */ int trader; /* trader number */ |