summaryrefslogtreecommitdiffstats
path: root/phantasia
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 /phantasia
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 'phantasia')
-rw-r--r--phantasia/gamesupport.c4
-rw-r--r--phantasia/interplayer.c4
-rw-r--r--phantasia/io.c4
-rw-r--r--phantasia/main.c4
-rw-r--r--phantasia/misc.c26
-rw-r--r--phantasia/phantglobs.c22
-rw-r--r--phantasia/phantglobs.h36
-rw-r--r--phantasia/phantstruct.h4
-rw-r--r--phantasia/setup.c10
9 files changed, 57 insertions, 57 deletions
diff --git a/phantasia/gamesupport.c b/phantasia/gamesupport.c
index b0ce0d8f..dbb3f0fd 100644
--- a/phantasia/gamesupport.c
+++ b/phantasia/gamesupport.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gamesupport.c,v 1.4 1997/10/13 02:18:16 lukem Exp $ */
+/* $NetBSD: gamesupport.c,v 1.5 1999/09/08 21:17:53 jsm Exp $ */
/*
* gamesupport.c - auxiliary routines for support of Phantasia
@@ -13,7 +13,7 @@ changestats(ingameflag)
static char flag[2] = /* for printing values of bools */
{'F', 'T'};
struct player *playerp; /* pointer to structure to alter */
- char *prompt; /* pointer to prompt string */
+ const char *prompt; /* pointer to prompt string */
int c; /* input */
int today; /* day of year of today */
int temp; /* temporary variable */
diff --git a/phantasia/interplayer.c b/phantasia/interplayer.c
index 8399f914..2344e0e9 100644
--- a/phantasia/interplayer.c
+++ b/phantasia/interplayer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: interplayer.c,v 1.3 1997/10/13 02:18:22 lukem Exp $ */
+/* $NetBSD: interplayer.c,v 1.4 1999/09/08 21:17:53 jsm Exp $ */
/*
* interplayer.c - player to player routines for Phantasia
@@ -656,7 +656,7 @@ void
dotampered()
{
short tamper; /* value for tampering with other players */
- char *option; /* pointer to option description */
+ const char *option; /* pointer to option description */
double temp1 = 0.0, temp2 = 0.0; /* other tampering values */
int ch; /* input */
long loc; /* location in energy void file */
diff --git a/phantasia/io.c b/phantasia/io.c
index 40fd952f..989a67db 100644
--- a/phantasia/io.c
+++ b/phantasia/io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.3 1997/10/13 02:18:25 lukem Exp $ */
+/* $NetBSD: io.c,v 1.4 1999/09/08 21:17:54 jsm Exp $ */
/*
* io.c - input/output routines for Phantasia
@@ -153,7 +153,7 @@ interrupt()
int
getanswer(choices, def)
- char *choices;
+ const char *choices;
bool def;
{
int ch; /* input */
diff --git a/phantasia/main.c b/phantasia/main.c
index 11cee82f..efa49e05 100644
--- a/phantasia/main.c
+++ b/phantasia/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.6 1999/08/18 01:39:16 hubertf Exp $ */
+/* $NetBSD: main.c,v 1.7 1999/09/08 21:17:54 jsm Exp $ */
/*
* Phantasia 3.3.2 -- Interterminal fantasy game
@@ -873,7 +873,7 @@ genchar(type)
int type;
{
int subscript; /* used for subscripting into Stattable */
- struct charstats *statptr; /* for pointing into Stattable */
+ const struct charstats *statptr; /* for pointing into Stattable */
subscript = type - '1';
diff --git a/phantasia/misc.c b/phantasia/misc.c
index 4b5dc0f4..89cd940b 100644
--- a/phantasia/misc.c
+++ b/phantasia/misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.4 1998/08/30 09:19:39 veego Exp $ */
+/* $NetBSD: misc.c,v 1.5 1999/09/08 21:17:54 jsm Exp $ */
/*
* misc.c Phantasia miscellaneous support routines
@@ -10,7 +10,7 @@
void
movelevel()
{
- struct charstats *statptr; /* for pointing into Stattable */
+ const struct charstats *statptr; /* for pointing into Stattable */
double new; /* new level */
double inc; /* increment between new and old levels */
@@ -60,15 +60,15 @@ movelevel()
death("Old age");
}
-char *
+const char *
descrlocation(playerp, shortflag)
struct player *playerp;
bool shortflag;
{
double circle; /* corresponding circle for coordinates */
int quadrant; /* quandrant of grid */
- char *label; /* pointer to place name */
- static char *nametable[4][4] = /* names of places */
+ const char *label; /* pointer to place name */
+ static const char *const nametable[4][4] = /* names of places */
{
{"Anorien", "Ithilien", "Rohan", "Lorien"},
{"Gondor", "Mordor", "Dunland", "Rovanion"},
@@ -412,7 +412,7 @@ displaystats()
void
allstatslist()
{
- static char *flags[] = /* to print value of some bools */
+ static const char *const flags[] = /* to print value of some bools */
{
"False",
" True"
@@ -442,13 +442,13 @@ allstatslist()
flags[(int)Player.p_palantir]);
}
-char *
+const char *
descrtype(playerp, shortflag)
struct player *playerp;
bool shortflag;
{
int type; /* for caluculating result subscript */
- static char *results[] =/* description table */
+ static const char *const results[] =/* description table */
{
" Magic User", " MU",
" Fighter", " F ",
@@ -508,7 +508,7 @@ descrtype(playerp, shortflag)
long
findname(name, playerp)
- char *name;
+ const char *name;
struct player *playerp;
{
long loc = 0; /* location in the file */
@@ -576,11 +576,11 @@ leavegame()
void
death(how)
- char *how;
+ const char *how;
{
FILE *fp; /* for updating various files */
int ch; /* input */
- static char *deathmesg[] =
+ static const char *const deathmesg[] =
/* add more messages here, if desired */
{
"You have been wounded beyond repair. ",
@@ -935,7 +935,7 @@ readmessage()
void
error(whichfile)
- char *whichfile;
+ const char *whichfile;
{
int (*funcp) __P((const char *,...));
@@ -973,7 +973,7 @@ ill_sig(whichsig)
/* NOTREACHED */
}
-char *
+const char *
descrstatus(playerp)
struct player *playerp;
{
diff --git a/phantasia/phantglobs.c b/phantasia/phantglobs.c
index 399de146..58769881 100644
--- a/phantasia/phantglobs.c
+++ b/phantasia/phantglobs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: phantglobs.c,v 1.4 1998/07/27 01:12:35 mycroft Exp $ */
+/* $NetBSD: phantglobs.c,v 1.5 1999/09/08 21:17:54 jsm Exp $ */
/*
* phantglobs.c - globals for Phantasia
@@ -30,7 +30,7 @@ jmp_buf Timeoenv; /* used for timing out waiting for input */
long Fileloc; /* location in file of player statistics */
const char *Login; /* pointer to login of player */
-char *Enemyname; /* pointer name of monster/player we are battling*/
+const char *Enemyname; /* pointer name of monster/player we are battling*/
struct player Player; /* stats for player */
struct player Other; /* stats for another player */
@@ -39,10 +39,10 @@ struct monster Curmonster;/* stats for current monster */
struct energyvoid Enrgyvoid;/* energy void buffer */
-struct charstats *Statptr;/* pointer into Stattable[] */
+const struct charstats *Statptr;/* pointer into Stattable[] */
/* lookup table for character type dependent statistics */
-struct charstats Stattable[7] = {
+const struct charstats Stattable[7] = {
/* MAGIC USER */
{
15.0, 200.0, 18.0, 175.0, 10,
@@ -92,7 +92,7 @@ struct charstats Stattable[7] = {
};
/* menu of items for purchase */
-struct menuitem Menu[] = {
+const struct menuitem Menu[] = {
{"Mana", 1},
{"Shield", 5},
{"Book", 200},
@@ -110,9 +110,9 @@ FILE *Energyvoidfp; /* pointer to open energy void file */
char Databuf[SZ_DATABUF]; /* a place to read data into */
/* some canned strings for messages */
-char Illcmd[] = "Illegal command.\n";
-char Illmove[] = "Too far.\n";
-char Illspell[] = "Illegal spell.\n";
-char Nomana[] = "Not enought mana for that spell.\n";
-char Somebetter[] = "But you already have something better.\n";
-char Nobetter[] = "That's no better than what you already have.\n";
+const char Illcmd[] = "Illegal command.\n";
+const char Illmove[] = "Too far.\n";
+const char Illspell[] = "Illegal spell.\n";
+const char Nomana[] = "Not enought mana for that spell.\n";
+const char Somebetter[] = "But you already have something better.\n";
+const char Nobetter[] = "That's no better than what you already have.\n";
diff --git a/phantasia/phantglobs.h b/phantasia/phantglobs.h
index 00077e55..008ae1de 100644
--- a/phantasia/phantglobs.h
+++ b/phantasia/phantglobs.h
@@ -1,4 +1,4 @@
-/* $NetBSD: phantglobs.h,v 1.5 1998/07/27 01:12:35 mycroft Exp $ */
+/* $NetBSD: phantglobs.h,v 1.6 1999/09/08 21:17:54 jsm Exp $ */
/*
* phantglobs.h - global declarations for Phantasia
@@ -28,7 +28,7 @@ extern jmp_buf Timeoenv; /* used for timing out waiting for input */
extern long Fileloc; /* location in file of player statistics */
extern const char *Login; /* pointer to login of current player */
-extern char *Enemyname; /* pointer name of monster/player we are battling*/
+extern const char *Enemyname; /* pointer name of monster/player we are battling*/
extern struct player Player; /* stats for player */
extern struct player Other; /* stats for another player */
@@ -37,11 +37,11 @@ extern struct monster Curmonster;/* stats for current monster */
extern struct energyvoid Enrgyvoid;/* energy void buffer */
-extern struct charstats Stattable[];/* used for rolling and changing player stats*/
+extern const struct charstats Stattable[];/* used for rolling and changing player stats*/
-extern struct charstats *Statptr;/* pointer into Stattable[] */
+extern const struct charstats *Statptr;/* pointer into Stattable[] */
-extern struct menuitem Menu[]; /* menu of items for purchase */
+extern const struct menuitem Menu[]; /* menu of items for purchase */
extern FILE *Playersfp; /* pointer to open player file */
extern FILE *Monstfp; /* pointer to open monster file */
@@ -51,18 +51,18 @@ extern FILE *Energyvoidfp; /* pointer to open energy void file */
extern char Databuf[]; /* a place to read data into */
/* some canned strings for messages */
-extern char Illcmd[];
-extern char Illmove[];
-extern char Illspell[];
-extern char Nomana[];
-extern char Somebetter[];
-extern char Nobetter[];
+extern const char Illcmd[];
+extern const char Illmove[];
+extern const char Illspell[];
+extern const char Nomana[];
+extern const char Somebetter[];
+extern const char Nobetter[];
/* functions which we need to know about */
-char *descrlocation __P((struct player *, bool));
-char *descrstatus __P((struct player *));
-char *descrtype __P((struct player *, bool));
+const char *descrlocation __P((struct player *, bool));
+const char *descrstatus __P((struct player *));
+const char *descrtype __P((struct player *, bool));
void activelist __P((void));
void adjuststats __P((void));
long allocrecord __P((void));
@@ -80,19 +80,19 @@ void checktampered __P((void));
void cleanup __P((int));
void collecttaxes __P((double, double));
void cursedtreasure __P((void));
-void death __P((char *));
+void death __P((const char *));
void displaystats __P((void));
double distance __P((double, double, double, double));
void dotampered __P((void));
double drandom __P((void));
void encounter __P((int));
void enterscore __P((void));
-void error __P((char *));
+void error __P((const char *));
double explevel __P((double));
-long findname __P((char *, struct player *));
+long findname __P((const char *, struct player *));
void freerecord __P((struct player *, long));
void genchar __P((int));
-int getanswer __P((char *, bool));
+int getanswer __P((const char *, bool));
void getstring __P((char *, int));
void hitmonster __P((double));
void ill_sig __P((int));
diff --git a/phantasia/phantstruct.h b/phantasia/phantstruct.h
index c7ada226..948bb232 100644
--- a/phantasia/phantstruct.h
+++ b/phantasia/phantstruct.h
@@ -1,4 +1,4 @@
-/* $NetBSD: phantstruct.h,v 1.2 1995/03/24 04:00:11 cgd Exp $ */
+/* $NetBSD: phantstruct.h,v 1.3 1999/09/08 21:17:55 jsm Exp $ */
/*
* phantstruct.h - structure definitions for Phantasia
@@ -121,6 +121,6 @@ struct charstats /* character type statistics */
struct menuitem /* menu item for purchase */
{
- char *item; /* menu item name */
+ const char *item; /* menu item name */
double cost; /* cost of item */
};
diff --git a/phantasia/setup.c b/phantasia/setup.c
index 6727d265..83a43603 100644
--- a/phantasia/setup.c
+++ b/phantasia/setup.c
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.8 1997/11/24 01:47:26 mrg Exp $ */
+/* $NetBSD: setup.c,v 1.9 1999/09/08 21:17:55 jsm Exp $ */
/*
* setup.c - set up all files for Phantasia
@@ -38,7 +38,7 @@
/
/************************************************************************/
-static char *files[] = { /* all files to create */
+static const char *const files[] = { /* all files to create */
_PATH_MONST,
_PATH_PEOPLE,
_PATH_MESS,
@@ -50,14 +50,14 @@ static char *files[] = { /* all files to create */
NULL,
};
-char *monsterfile="monsters.asc";
+const char *monsterfile = "monsters.asc";
int
main(argc, argv)
int argc;
char *argv[];
{
- register char **filename; /* for pointing to file names */
+ register const char *const *filename; /* for pointing to file names */
register int fd; /* file descriptor */
FILE *fp; /* for opening files */
struct stat fbuf; /* for getting files statistics */
@@ -235,7 +235,7 @@ main(argc, argv)
/************************************************************************/
Error(str, file)
-char *str, *file;
+ const char *str, *file;
{
fprintf(stderr, "Error: ");
fprintf(stderr, str, file);