summaryrefslogtreecommitdiffstats
path: root/mille
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>1999-09-08 21:17:44 +0000
committerjsm <jsm@NetBSD.org>1999-09-08 21:17:44 +0000
commit04f4d7044367099914cf1906ae27ac20c24e44cf (patch)
treec17cb5c2f270bbb70eeba18cbe2bcfa43cfd8e10 /mille
parentf9706028dd6e2afabb6bd63d02d7bc90f78e4aab (diff)
downloadbsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.gz
bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.zst
bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.zip
Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the NetBSD games, except in hunt (where substantial changes from OpenBSD need to be looked at). Some such changes were previously covered in PRs bin/6041, bin/6146, bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994, bin/8039, bin/8057 and bin/8093.
Diffstat (limited to 'mille')
-rw-r--r--mille/comp.c8
-rw-r--r--mille/extern.c28
-rw-r--r--mille/mille.h24
-rw-r--r--mille/move.c8
-rw-r--r--mille/print.c6
-rw-r--r--mille/save.c6
6 files changed, 41 insertions, 39 deletions
diff --git a/mille/comp.c b/mille/comp.c
index 6ca5ad76..02be40f7 100644
--- a/mille/comp.c
+++ b/mille/comp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: comp.c,v 1.5 1997/10/12 00:53:45 lukem Exp $ */
+/* $NetBSD: comp.c,v 1.6 1999/09/08 21:17:50 jsm Exp $ */
/*
* Copyright (c) 1982, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)comp.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: comp.c,v 1.5 1997/10/12 00:53:45 lukem Exp $");
+__RCSID("$NetBSD: comp.c,v 1.6 1999/09/08 21:17:50 jsm Exp $");
#endif
#endif /* not lint */
@@ -408,7 +408,7 @@ play_it:
*/
int
onecard(pp)
- PLAY *pp;
+ const PLAY *pp;
{
CARD bat, spd, card;
@@ -441,7 +441,7 @@ onecard(pp)
int
canplay(pp, op, card)
- PLAY *pp, *op;
+ const PLAY *pp, *op;
CARD card;
{
switch (card) {
diff --git a/mille/extern.c b/mille/extern.c
index 64ae3e6b..81039ff0 100644
--- a/mille/extern.c
+++ b/mille/extern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.5 1997/10/12 00:53:55 lukem Exp $ */
+/* $NetBSD: extern.c,v 1.6 1999/09/08 21:17:50 jsm Exp $ */
/*
* Copyright (c) 1982, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: extern.c,v 1.5 1997/10/12 00:53:55 lukem Exp $");
+__RCSID("$NetBSD: extern.c,v 1.6 1999/09/08 21:17:50 jsm Exp $");
#endif
#endif /* not lint */
@@ -55,10 +55,10 @@ bool Debug, /* set if debugging code on */
Order, /* set if hand should be sorted */
Saved; /* set if game just saved */
-char *C_fmt = "%-18.18s", /* format for printing cards */
+char Initstr[100]; /* initial string for error field */
+const char *C_fmt = "%-18.18s", /* format for printing cards */
*Fromfile = NULL, /* startup file for game */
- Initstr[100], /* initial string for error field */
- *_cn[NUM_CARDS] = { /* Card name buffer */
+ *const _cn[NUM_CARDS] = { /* Card name buffer */
"",
"25",
"50",
@@ -80,7 +80,7 @@ char *C_fmt = "%-18.18s", /* format for printing cards */
"Driving Ace",
"Right of Way"
},
- **C_name = &_cn[1]; /* Card names */
+ *const *C_name = &_cn[1]; /* Card names */
int Card_no, /* Card number for current move */
End, /* End value for current hand */
@@ -89,8 +89,8 @@ int Card_no, /* Card number for current move */
Play, /* Current player */
Numgos, /* Number of Go cards used by computer */
Window = W_SMALL, /* Current window wanted */
- Numseen[NUM_CARDS], /* Number of cards seen in current hand */
- Value[NUM_MILES] = { /* Value of mileage cards */
+ Numseen[NUM_CARDS]; /* Number of cards seen in current hand */
+const int Value[NUM_MILES] = { /* Value of mileage cards */
25, 50, 75, 100, 200
},
Numcards[NUM_CARDS] = { /* Number of cards in deck */
@@ -114,8 +114,8 @@ int Card_no, /* Card number for current move */
1, /* C_DRIVE_SAFE */
1, /* C_RIGHT_WAY */
0 /* C_INIT */
- },
- Numneed[NUM_CARDS] = { /* number of cards needed per hand */
+ };
+int Numneed[NUM_CARDS] = { /* number of cards needed per hand */
0, /* C_25 */
0, /* C_50 */
0, /* C_75 */
@@ -140,13 +140,13 @@ int Card_no, /* Card number for current move */
CARD Discard, /* Top of discard pile */
Sh_discard, /* Last discard card shown */
- *Topcard, /* Pointer to next card to be picked */
- Opposite[NUM_CARDS] = { /* Opposites of each card */
+ *Topcard; /* Pointer to next card to be picked */
+const CARD Opposite[NUM_CARDS] = { /* Opposites of each card */
C_25, C_50, C_75, C_100, C_200, C_GAS, C_SPARE,
C_REPAIRS, C_GO, C_END_LIMIT, C_EMPTY, C_FLAT, C_CRASH,
C_STOP, C_LIMIT, C_EMPTY, C_FLAT, C_CRASH, C_STOP, C_INIT
- },
- Deck[DECK_SZ] = { /* Current deck */
+ };
+CARD Deck[DECK_SZ] = { /* Current deck */
C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25,
C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50,
C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75,
diff --git a/mille/mille.h b/mille/mille.h
index 416e9f0d..c110c6b2 100644
--- a/mille/mille.h
+++ b/mille/mille.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mille.h,v 1.9 1998/09/13 15:27:29 hubertf Exp $ */
+/* $NetBSD: mille.h,v 1.10 1999/09/08 21:17:50 jsm Exp $ */
/*
* Copyright (c) 1982, 1993
@@ -207,13 +207,15 @@ typedef struct {
extern bool Debug, Finished, Next, On_exit, Order, Saved;
-extern char *C_fmt, **C_name, *Fromfile, Initstr[];
+extern char Initstr[];
+extern const char *C_fmt, *const *C_name, *Fromfile;
-extern int Card_no, End, Handstart, Movetype, Numcards[], Numgos,
- Numneed[], Numseen[NUM_CARDS], Play, Value[], Window;
+extern int Card_no, End, Handstart, Movetype, Numgos,
+ Numneed[], Numseen[NUM_CARDS], Play, Window;
+extern const int Numcards[], Value[];
-extern CARD Deck[DECK_SZ], Discard, Opposite[NUM_CARDS], Sh_discard,
- *Topcard;
+extern CARD Deck[DECK_SZ], Discard, Sh_discard, *Topcard;
+extern const CARD Opposite[NUM_CARDS];
extern FILE *outf;
@@ -227,7 +229,7 @@ extern WINDOW *Board, *Miles, *Score;
void account __P((CARD));
void calcmove __P((void));
-int canplay __P((PLAY *, PLAY *, CARD));
+int canplay __P((const PLAY *, const PLAY *, CARD));
int check_ext __P((bool));
void check_go __P((void));
void check_more __P((void));
@@ -239,19 +241,19 @@ void finalscore __P((PLAY *));
CARD getcard __P((void));
void getmove __P((void));
int getyn __P((int));
-int haspicked __P((PLAY *));
+int haspicked __P((const PLAY *));
void init __P((void));
int isrepair __P((CARD));
int main __P((int, char **));
void newboard __P((void));
void newscore __P((void));
-int onecard __P((PLAY *));
+int onecard __P((const PLAY *));
int playcard __P((PLAY *));
void prboard __P((void));
void prompt __P((int));
-void prscore __P((int));
+void prscore __P((bool));
int readch __P((void));
-bool rest_f __P((char *));
+bool rest_f __P((const char *));
int roll __P((int, int));
void rub __P((int));
int safety __P((CARD));
diff --git a/mille/move.c b/mille/move.c
index 38d82846..afc3acb6 100644
--- a/mille/move.c
+++ b/mille/move.c
@@ -1,4 +1,4 @@
-/* $NetBSD: move.c,v 1.9 1999/09/08 20:43:48 jsm Exp $ */
+/* $NetBSD: move.c,v 1.10 1999/09/08 21:17:51 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: move.c,v 1.9 1999/09/08 20:43:48 jsm Exp $");
+__RCSID("$NetBSD: move.c,v 1.10 1999/09/08 21:17:51 jsm Exp $");
#endif
#endif /* not lint */
@@ -475,7 +475,7 @@ ret:
*/
int
haspicked(pp)
- PLAY *pp;
+ const PLAY *pp;
{
int card;
@@ -523,7 +523,7 @@ void
prompt(promptno)
int promptno;
{
- static char *names[] = {
+ static const char *const names[] = {
">>:Move:",
"Really?",
"Another hand?",
diff --git a/mille/print.c b/mille/print.c
index dee19d4a..042b8162 100644
--- a/mille/print.c
+++ b/mille/print.c
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.6 1997/10/12 00:54:24 lukem Exp $ */
+/* $NetBSD: print.c,v 1.7 1999/09/08 21:17:51 jsm Exp $ */
/*
* Copyright (c) 1982, 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.6 1997/10/12 00:54:24 lukem Exp $");
+__RCSID("$NetBSD: print.c,v 1.7 1999/09/08 21:17:51 jsm Exp $");
#endif
#endif /* not lint */
@@ -70,7 +70,7 @@ prboard()
show_card(14, temp, pp->battle, &pp->sh_battle);
show_card(16, temp, pp->speed, &pp->sh_speed);
for (i = C_25; i <= C_200; i++) {
- char *name;
+ const char *name;
int end;
if (pp->nummiles[i] == pp->sh_nummiles[i])
diff --git a/mille/save.c b/mille/save.c
index 3715f7b0..3d9d17c2 100644
--- a/mille/save.c
+++ b/mille/save.c
@@ -1,4 +1,4 @@
-/* $NetBSD: save.c,v 1.7 1999/03/29 05:12:39 mrg Exp $ */
+/* $NetBSD: save.c,v 1.8 1999/09/08 21:17:51 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: save.c,v 1.7 1999/03/29 05:12:39 mrg Exp $");
+__RCSID("$NetBSD: save.c,v 1.8 1999/09/08 21:17:51 jsm Exp $");
#endif
#endif /* not lint */
@@ -144,7 +144,7 @@ over:
*/
bool
rest_f(file)
- char *file;
+ const char *file;
{
char *sp;