phantasia(6) needs some KNF love, but for now here is a patch to ansify it:
Index: fight.c
===================================================================
RCS file: /cvs/src/games/phantasia/fight.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 fight.c
--- fight.c 12 Jul 2014 03:41:04 -0000 1.11
+++ fight.c 2 Dec 2015 19:25:53 -0000
@@ -38,8 +38,7 @@
*************************************************************************/
void
-encounter(particular)
- int particular;
+encounter(int particular)
{
int flockcnt = 1; /* how many time flocked */
volatile bool firsthit = Player.p_blessing; /* set if player gets
@@ -207,7 +206,7 @@ encounter(particular)
*************************************************************************/
int
-pickmonster()
+pickmonster(void)
{
if (Player.p_specialtype == SC_VALAR)
/* even chance of any monster */
@@ -264,7 +263,7 @@ pickmonster()
*************************************************************************/
void
-playerhits()
+playerhits(void)
{
double inflict; /* damage inflicted */
int ch; /* input */
@@ -435,7 +434,7 @@ playerhits()
*************************************************************************/
void
-monsthits()
+monsthits(void)
{
double inflict; /* damage inflicted */
int ch; /* input */
@@ -709,7 +708,7 @@ SPECIALHIT:
*************************************************************************/
void
-cancelmonster()
+cancelmonster(void)
{
Curmonster.m_energy = 0.0;
Curmonster.m_experience = 0.0;
@@ -743,8 +742,7 @@ cancelmonster()
*************************************************************************/
void
-hitmonster(inflict)
- double inflict;
+hitmonster(double inflict)
{
mvprintw(Lines++, 0, "You hit %s %.0f times!", Enemyname, inflict);
Curmonster.m_energy -= inflict;
@@ -797,7 +795,7 @@ hitmonster(inflict)
*************************************************************************/
void
-throwspell()
+throwspell(void)
{
double inflict; /* damage inflicted */
double dtemp; /* for dtemporary calculations */
@@ -1028,8 +1026,7 @@ throwspell()
*************************************************************************/
void
-callmonster(which)
- int which;
+callmonster(int which)
{
struct monster Othermonster; /* to find a name for mimics */
@@ -1136,7 +1133,7 @@ callmonster(which)
*************************************************************************/
void
-awardtreasure()
+awardtreasure(void)
{
int whichtreasure; /* calculated treasure to grant */
int temp; /* temporary */
@@ -1573,7 +1570,7 @@ awardtreasure()
*************************************************************************/
void
-cursedtreasure()
+cursedtreasure(void)
{
if (Player.p_charms > 0) {
addstr("But your charm saved you!\n");
@@ -1613,7 +1610,7 @@ cursedtreasure()
*************************************************************************/
void
-scramblestats()
+scramblestats(void)
{
double dbuf[6]; /* to put statistic in */
double dtemp1, dtemp2; /* for swapping values */
Index: gamesupport.c
===================================================================
RCS file: /cvs/src/games/phantasia/gamesupport.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 gamesupport.c
--- gamesupport.c 15 Dec 2010 06:40:39 -0000 1.7
+++ gamesupport.c 2 Dec 2015 19:25:55 -0000
@@ -54,8 +54,7 @@
*************************************************************************/
void
-changestats(ingameflag)
- bool ingameflag;
+changestats(bool ingameflag)
{
static char flag[2] = /* for printing values of bools */
{'F', 'T'};
@@ -509,7 +508,7 @@ BALTER:
*************************************************************************/
void
-monstlist()
+monstlist(void)
{
int count = 0; /* count in file */
@@ -546,7 +545,7 @@ monstlist()
*************************************************************************/
void
-scorelist()
+scorelist(void)
{
struct scoreboard sbuf; /* for reading entries */
FILE *fp; /* to open the file */
@@ -583,7 +582,7 @@ scorelist()
*************************************************************************/
void
-activelist()
+activelist(void)
{
fseek(Playersfp, 0L, SEEK_SET);
printf("Current characters on file are:\n\n");
@@ -621,7 +620,7 @@ activelist()
*************************************************************************/
void
-purgeoldplayers()
+purgeoldplayers(void)
{
int today; /* day of year for today */
int daysold; /* how many days since the character has been
@@ -678,7 +677,7 @@ purgeoldplayers()
*************************************************************************/
void
-enterscore()
+enterscore(void)
{
struct scoreboard sbuf; /* buffer to read in scoreboard entries */
FILE *fp; /* to open scoreboard file */
Index: interplayer.c
===================================================================
RCS file: /cvs/src/games/phantasia/interplayer.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 interplayer.c
--- interplayer.c 12 Jul 2014 03:41:04 -0000 1.6
+++ interplayer.c 2 Dec 2015 19:25:57 -0000
@@ -33,7 +33,7 @@
*************************************************************************/
void
-checkbattle()
+checkbattle(void)
{
long foeloc = 0L; /* location in file of person to fight */
@@ -110,8 +110,7 @@ checkbattle()
*************************************************************************/
void
-battleplayer(foeplace)
- long foeplace;
+battleplayer(long foeplace)
{
double dtemp; /* for temporary calculations */
double oldhits = 0.0; /* previous damage inflicted by foe */
@@ -357,7 +356,7 @@ LEAVE:
*************************************************************************/
void
-myturn()
+myturn(void)
{
double dtemp; /* for temporary calculations */
int ch; /* input */
@@ -459,7 +458,7 @@ HIT:
*************************************************************************/
void
-checktampered()
+checktampered(void)
{
long loc = 0L; /* location in energy void file */
@@ -520,10 +519,7 @@ checktampered()
*************************************************************************/
void
-tampered(what, arg1, arg2)
- int what;
- double arg1;
- double arg2;
+tampered(int what, double arg1, double arg2)
{
long loc; /* location in file of other players */
@@ -704,8 +700,7 @@ tampered(what, arg1, arg2)
*************************************************************************/
void
-userlist(ingameflag)
- bool ingameflag;
+userlist(bool ingameflag)
{
int numusers = 0; /* number of users on file */
@@ -795,7 +790,7 @@ userlist(ingameflag)
*************************************************************************/
void
-throneroom()
+throneroom(void)
{
FILE *fp; /* to clear energy voids */
long loc = 0L; /* location of old king in player file */
@@ -876,7 +871,7 @@ throneroom()
*************************************************************************/
void
-dotampered()
+dotampered(void)
{
short tamper; /* value for tampering with other players */
char *option; /* pointer to option description */
@@ -1108,9 +1103,7 @@ dotampered()
*************************************************************************/
void
-writevoid(vp, loc)
- struct energyvoid *vp;
- long loc;
+writevoid(struct energyvoid *vp, long loc)
{
fseek(Energyvoidfp, loc, SEEK_SET);
@@ -1145,7 +1138,7 @@ writevoid(vp, loc)
*************************************************************************/
long
-allocvoid()
+allocvoid(void)
{
long loc = 0L; /* location of new energy void */
Index: io.c
===================================================================
RCS file: /cvs/src/games/phantasia/io.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 io.c
--- io.c 12 Jul 2014 03:41:04 -0000 1.6
+++ io.c 2 Dec 2015 19:25:58 -0000
@@ -43,9 +43,7 @@
*************************************************************************/
void
-getstring(cp, mx)
- char *cp;
- int mx;
+getstring(char *cp, int mx)
{
char *inptr; /* pointer into string for next string */
int x, y; /* original x, y coordinates on screen */
@@ -119,8 +117,7 @@ getstring(cp, mx)
*************************************************************************/
void
-more(where)
- int where;
+more(int where)
{
mvaddstr(where, 0, "-- more --");
getanswer(" ", FALSE);
@@ -152,7 +149,7 @@ more(where)
*************************************************************************/
double
-infloat()
+infloat(void)
{
double result; /* return value */
@@ -190,7 +187,7 @@ infloat()
*************************************************************************/
int
-inputoption()
+inputoption(void)
{
++Player.p_age; /* increase age */
@@ -233,7 +230,7 @@ inputoption()
*************************************************************************/
void
-interrupt()
+interrupt(void)
{
char line[81]; /* a place to store data already on screen */
int loop; /* counter */
@@ -307,9 +304,7 @@ interrupt()
*************************************************************************/
int
-getanswer(choices, def)
- char *choices;
- bool def;
+getanswer(char *choices, bool def)
{
int ch; /* input */
volatile int loop; /* counter */
@@ -407,8 +402,7 @@ getanswer(choices, def)
*************************************************************************/
void
-catchalarm(dummy)
- int dummy;
+catchalarm(int dummy)
{
longjmp(Timeoenv, 1);
}
Index: main.c
===================================================================
RCS file: /cvs/src/games/phantasia/main.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 main.c
--- main.c 16 Nov 2014 04:49:48 -0000 1.17
+++ main.c 2 Dec 2015 19:26:00 -0000
@@ -95,9 +95,7 @@
****************************************************************************/
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
bool noheader = FALSE; /* set if don't want header */
bool headeronly = FALSE; /* set if only want header */
@@ -313,7 +311,7 @@ main(argc, argv)
*************************************************************************/
void
-initialstate()
+initialstate(void)
{
#ifdef TERMIOS
struct termios tty;
@@ -398,7 +396,7 @@ initialstate()
*************************************************************************/
long
-rollnewplayer()
+rollnewplayer(void)
{
int chartype; /* character type */
int ch; /* input */
@@ -515,7 +513,7 @@ rollnewplayer()
*************************************************************************/
void
-procmain()
+procmain(void)
{
int ch; /* input */
double x; /* desired new x coordinate */
@@ -749,7 +747,7 @@ procmain()
*************************************************************************/
void
-titlelist()
+titlelist(void)
{
FILE *fp; /* used for opening various files */
bool councilfound = FALSE; /* set if we find a member of the
@@ -883,7 +881,7 @@ titlelist()
*************************************************************************/
long
-recallplayer()
+recallplayer(void)
{
long loc = 0L; /* location in player file */
int loop; /* loop counter */
@@ -966,7 +964,7 @@ recallplayer()
*************************************************************************/
void
-neatstuff()
+neatstuff(void)
{
double temp; /* for temporary calculations */
int ch; /* input */
@@ -1090,8 +1088,7 @@ neatstuff()
*************************************************************************/
void
-genchar(type)
- int type;
+genchar(int type)
{
int subscript; /* used for subscripting into Stattable */
struct charstats *statptr; /* for pointing into Stattable */
@@ -1151,7 +1148,7 @@ genchar(type)
*************************************************************************/
void
-playinit()
+playinit(void)
{
initscr(); /* turn on curses */
noecho(); /* do not echo input */
@@ -1188,8 +1185,7 @@ playinit()
*************************************************************************/
void
-cleanup(doexit)
- int doexit;
+cleanup(int doexit)
{
if (Windows) {
move(LINES - 2, 0);
Index: map.c
===================================================================
RCS file: /cvs/src/games/phantasia/map.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 map.c
--- map.c 28 Jan 2001 23:41:47 -0000 1.2
+++ map.c 2 Dec 2015 19:26:01 -0000
@@ -4,7 +4,8 @@
#define minusminus plusplus
#define minusplus plusminus
-main()
+void
+main(void)
{
/* Set up */
@@ -128,9 +129,8 @@ main()
exit(0);
}
-plusplus(s, x, y) /* draw strings in plus plus quadrant */
-char *s;
-int x, y;
+void
+plusplus(char *s, int x, int y) /* draw strings in plus plus quadrant */
{
char s1[2];
@@ -145,9 +145,8 @@ char s1[2];
}
}
-plusminus(s, x, y) /* draw strings in plus minus quadrant */
-char *s;
-int x, y;
+void
+plusminus(char *s, int x, int y) /* draw strings in plus minus quadrant
*/
{
char s1[2];
Index: misc.c
===================================================================
RCS file: /cvs/src/games/phantasia/misc.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 misc.c
--- misc.c 12 Jul 2014 03:41:04 -0000 1.16
+++ misc.c 2 Dec 2015 19:26:03 -0000
@@ -37,7 +37,7 @@
*************************************************************************/
void
-movelevel()
+movelevel(void)
{
struct charstats *statptr; /* for pointing into Stattable */
double new; /* new level */
@@ -116,9 +116,7 @@ movelevel()
*************************************************************************/
char *
-descrlocation(playerp, shortflag)
- struct player *playerp;
- bool shortflag;
+descrlocation(struct player *playerp, bool shortflag)
{
double circle; /* corresponding circle for coordinates */
int quadrant; /* quandrant of grid */
@@ -215,7 +213,7 @@ descrlocation(playerp, shortflag)
*************************************************************************/
void
-tradingpost()
+tradingpost(void)
{
double numitems; /* number of items to purchase */
double cost; /* cost of purchase */
@@ -486,7 +484,7 @@ tradingpost()
*************************************************************************/
void
-displaystats()
+displaystats(void)
{
mvprintw(0, 0, "%s%s\n", Player.p_name, descrlocation(&Player, FALSE));
mvprintw(1, 0, "Level :%7.0f Energy :%9.0f(%9.0f) Mana :%9.0f
Users:%3d\n",
@@ -521,7 +519,7 @@ displaystats()
*************************************************************************/
void
-allstatslist()
+allstatslist(void)
{
static char *flags[] = /* to print value of some bools */
{
@@ -583,9 +581,7 @@ allstatslist()
*************************************************************************/
char *
-descrtype(playerp, shortflag)
- struct player *playerp;
- bool shortflag;
+descrtype(struct player *playerp, bool shortflag)
{
int type; /* for caluculating result subscript */
static char *results[] =/* description table */
@@ -673,9 +669,7 @@ descrtype(playerp, shortflag)
*************************************************************************/
long
-findname(name, playerp)
- char *name;
- struct player *playerp;
+findname(char *name, struct player *playerp)
{
long loc = 0; /* location in the file */
@@ -717,7 +711,7 @@ findname(name, playerp)
*************************************************************************/
long
-allocrecord()
+allocrecord(void)
{
long loc = 0L; /* location in file */
@@ -764,9 +758,7 @@ allocrecord()
*************************************************************************/
void
-freerecord(playerp, loc)
- struct player *playerp;
- long loc;
+freerecord(struct player *playerp, long loc)
{
playerp->p_name[0] = CH_MARKDELETE;
playerp->p_status = S_NOTUSED;
@@ -798,7 +790,7 @@ freerecord(playerp, loc)
*************************************************************************/
void
-leavegame()
+leavegame(void)
{
if (Player.p_level < 1.0)
@@ -845,8 +837,7 @@ leavegame()
*************************************************************************/
void
-death(how)
- char *how;
+death(char *how)
{
FILE *fp; /* for updating various files */
int ch; /* input */
@@ -968,9 +959,7 @@ death(how)
*************************************************************************/
void
-writerecord(playerp, place)
- struct player *playerp;
- long place;
+writerecord(struct player *playerp, long place)
{
fseek(Playersfp, place, SEEK_SET);
fwrite(playerp, SZ_PLAYERSTRUCT, 1, Playersfp);
@@ -1003,8 +992,7 @@ writerecord(playerp, place)
*************************************************************************/
double
-explevel(experience)
- double experience;
+explevel(double experience)
{
if (experience < 1.1e7)
return (floor(pow((experience / 1000.0), 0.4875)));
@@ -1037,8 +1025,7 @@ explevel(experience)
*************************************************************************/
void
-truncstring(string)
- char *string;
+truncstring(char *string)
{
int length; /* length of string */
@@ -1075,10 +1062,7 @@ truncstring(string)
*************************************************************************/
void
-altercoordinates(xnew, ynew, operation)
- double xnew;
- double ynew;
- int operation;
+altercoordinates(double xnew, double ynew, int operation)
{
switch (operation) {
case A_FORCED: /* move with no checks */
@@ -1151,9 +1135,7 @@ altercoordinates(xnew, ynew, operation)
*************************************************************************/
void
-readrecord(playerp, loc)
- struct player *playerp;
- long loc;
+readrecord(struct player *playerp, long loc)
{
fseek(Playersfp, loc, SEEK_SET);
fread(playerp, SZ_PLAYERSTRUCT, 1, Playersfp);
@@ -1183,7 +1165,7 @@ readrecord(playerp, loc)
*************************************************************************/
void
-adjuststats()
+adjuststats(void)
{
double dtemp; /* for temporary calculations */
@@ -1298,8 +1280,7 @@ adjuststats()
*************************************************************************/
void
-initplayer(playerp)
- struct player *playerp;
+initplayer(struct player *playerp)
{
playerp->p_experience =
playerp->p_level =
@@ -1381,7 +1362,7 @@ initplayer(playerp)
*************************************************************************/
void
-readmessage()
+readmessage(void)
{
move(3, 0);
clrtoeol();
@@ -1415,8 +1396,7 @@ readmessage()
*************************************************************************/
void
-error(whichfile)
- char *whichfile;
+error(char *whichfile)
{
if (Windows)
@@ -1456,8 +1436,7 @@ error(whichfile)
*************************************************************************/
double
-distance(x1, x2, y1, y2)
- double x1, x2, y1, y2;
+distance(double x1, double x2, double y1, double y2)
{
double deltax, deltay;
@@ -1491,8 +1470,7 @@ distance(x1, x2, y1, y2)
*************************************************************************/
char *
-descrstatus(playerp)
- struct player *playerp;
+descrstatus(struct player *playerp)
{
switch (playerp->p_status) {
case S_PLAYING:
@@ -1551,7 +1529,7 @@ descrstatus(playerp)
*************************************************************************/
double
-drandom()
+drandom(void)
{
return ((double) arc4random() / (UINT32_MAX + 1.0));
}
@@ -1585,9 +1563,7 @@ drandom()
*************************************************************************/
void
-collecttaxes(gold, gems)
- double gold;
- double gems;
+collecttaxes(double gold, double gems)
{
FILE *fp; /* to update Goldfile */
double dtemp; /* for temporary calculations */
Index: setup.c
===================================================================
RCS file: /cvs/src/games/phantasia/setup.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 setup.c
--- setup.c 16 Nov 2014 04:49:48 -0000 1.13
+++ setup.c 2 Dec 2015 19:26:08 -0000
@@ -59,9 +59,7 @@ static char *files[] = { /* all files t
char *monsterfile="monsters.asc";
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
char **filename; /* for pointing to file names */
int fd; /* file descriptor */
@@ -203,8 +201,7 @@ main(argc, argv)
*************************************************************************/
void
-Error(str, file)
- char *str, *file;
+Error(char *str, char *file)
{
fprintf(stderr, "Error: ");
fprintf(stderr, str, file);
@@ -236,7 +233,7 @@ Error(str, file)
*************************************************************************/
double
-drandom()
+drandom(void)
{
return((double) arc4random() / (UINT32_MAX + 1.0));
}