From 28a2fb534d0a6db57738352113f148c57f1078f1 Mon Sep 17 00:00:00 2001 From: dholland Date: Mon, 25 May 2009 23:08:45 +0000 Subject: ANSIfy function declarations. Object file diffs cross-checked. --- phantasia/fight.c | 27 ++++++++--------- phantasia/gamesupport.c | 15 +++++----- phantasia/interplayer.c | 29 +++++++------------ phantasia/io.c | 22 +++++--------- phantasia/main.c | 26 +++++++---------- phantasia/misc.c | 77 +++++++++++++++++-------------------------------- phantasia/setup.c | 11 +++---- 7 files changed, 79 insertions(+), 128 deletions(-) (limited to 'phantasia') diff --git a/phantasia/fight.c b/phantasia/fight.c index cb446828..d001dabe 100644 --- a/phantasia/fight.c +++ b/phantasia/fight.c @@ -1,4 +1,4 @@ -/* $NetBSD: fight.c,v 1.10 2004/04/11 13:35:06 he Exp $ */ +/* $NetBSD: fight.c,v 1.11 2009/05/25 23:08:45 dholland Exp $ */ /* * fight.c Phantasia monster fighting routines @@ -9,8 +9,7 @@ #include void -encounter(particular) - int particular; +encounter(int particular) { volatile bool firsthit = Player.p_blessing; /* set if player gets * the first hit */ @@ -154,7 +153,7 @@ encounter(particular) } int -pickmonster() +pickmonster(void) { if (Player.p_specialtype == SC_VALAR) /* even chance of any monster */ @@ -194,7 +193,7 @@ pickmonster() } void -playerhits() +playerhits(void) { double inflict; /* damage inflicted */ int ch; /* input */ @@ -337,7 +336,7 @@ playerhits() } void -monsthits() +monsthits(void) { double inflict; /* damage inflicted */ int ch; /* input */ @@ -587,7 +586,7 @@ SPECIALHIT: } void -cancelmonster() +cancelmonster(void) { Curmonster.m_energy = 0.0; Curmonster.m_experience = 0.0; @@ -596,8 +595,7 @@ cancelmonster() } void -hitmonster(inflict) - double inflict; +hitmonster(double inflict) { mvprintw(Lines++, 0, "You hit %s %.0f times!", Enemyname, inflict); Curmonster.m_energy -= inflict; @@ -624,7 +622,7 @@ hitmonster(inflict) } void -throwspell() +throwspell(void) { double inflict; /* damage inflicted */ double dtemp; /* for dtemporary calculations */ @@ -834,8 +832,7 @@ throwspell() } void -callmonster(which) - int which; +callmonster(int which) { struct monster Othermonster; /* to find a name for mimics */ @@ -912,7 +909,7 @@ callmonster(which) } void -awardtreasure() +awardtreasure(void) { int whichtreasure; /* calculated treasure to grant */ int temp; /* temporary */ @@ -1336,7 +1333,7 @@ awardtreasure() } void -cursedtreasure() +cursedtreasure(void) { if (Player.p_charms > 0) { addstr("But your charm saved you!\n"); @@ -1353,7 +1350,7 @@ cursedtreasure() } void -scramblestats() +scramblestats(void) { double dbuf[6]; /* to put statistic in */ double dtemp1, dtemp2; /* for swapping values */ diff --git a/phantasia/gamesupport.c b/phantasia/gamesupport.c index 2bfc67f6..b05f1ff5 100644 --- a/phantasia/gamesupport.c +++ b/phantasia/gamesupport.c @@ -1,4 +1,4 @@ -/* $NetBSD: gamesupport.c,v 1.9 2005/02/15 12:58:21 jsm Exp $ */ +/* $NetBSD: gamesupport.c,v 1.10 2009/05/25 23:08:45 dholland Exp $ */ /* * gamesupport.c - auxiliary routines for support of Phantasia @@ -9,8 +9,7 @@ #include void -changestats(ingameflag) - phbool ingameflag; +changestats(phbool ingameflag) { static char flag[2] = /* for printing values of bools */ {'F', 'T'}; @@ -440,7 +439,7 @@ BALTER: } void -monstlist() +monstlist(void) { int count = 0; /* count in file */ @@ -454,7 +453,7 @@ monstlist() } void -scorelist() +scorelist(void) { struct scoreboard sbuf; /* for reading entries */ FILE *fp; /* to open the file */ @@ -468,7 +467,7 @@ scorelist() } void -activelist() +activelist(void) { fseek(Playersfp, 0L, SEEK_SET); printf("Current characters on file are:\n\n"); @@ -482,7 +481,7 @@ activelist() } void -purgeoldplayers() +purgeoldplayers(void) { int today; /* day of year for today */ int daysold; /* how many days since the character has been @@ -511,7 +510,7 @@ purgeoldplayers() } void -enterscore() +enterscore(void) { struct scoreboard sbuf; /* buffer to read in scoreboard entries */ FILE *fp; /* to open scoreboard file */ diff --git a/phantasia/interplayer.c b/phantasia/interplayer.c index 3cb786c0..d47d32e0 100644 --- a/phantasia/interplayer.c +++ b/phantasia/interplayer.c @@ -1,4 +1,4 @@ -/* $NetBSD: interplayer.c,v 1.9 2005/02/15 12:58:21 jsm Exp $ */ +/* $NetBSD: interplayer.c,v 1.10 2009/05/25 23:08:45 dholland Exp $ */ /* * interplayer.c - player to player routines for Phantasia @@ -9,7 +9,7 @@ #include void -checkbattle() +checkbattle(void) { long foeloc = 0L; /* location in file of person to fight */ @@ -46,8 +46,7 @@ checkbattle() } void -battleplayer(foeplace) - long foeplace; +battleplayer(long foeplace) { double dtemp; /* for temporary calculations */ double oldhits = 0.0; /* previous damage inflicted by foe */ @@ -275,7 +274,7 @@ LEAVE: } void -myturn() +myturn(void) { double dtemp; /* for temporary calculations */ int ch; /* input */ @@ -353,7 +352,7 @@ HIT: } void -checktampered() +checktampered(void) { long loc = 0L; /* location in energy void file */ @@ -386,10 +385,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 */ @@ -538,8 +534,7 @@ tampered(what, arg1, arg2) } void -userlist(ingameflag) - phbool ingameflag; +userlist(phbool ingameflag) { int numusers = 0; /* number of users on file */ @@ -601,7 +596,7 @@ userlist(ingameflag) } void -throneroom() +throneroom(void) { FILE *fp; /* to clear energy voids */ long loc = 0L; /* location of old king in player file */ @@ -655,7 +650,7 @@ throneroom() } void -dotampered() +dotampered(void) { short tamper; /* value for tampering with other players */ const char *option; /* pointer to option description */ @@ -862,9 +857,7 @@ dotampered() } void -writevoid(vp, loc) - struct energyvoid *vp; - long loc; +writevoid(struct energyvoid *vp, long loc) { fseek(Energyvoidfp, loc, SEEK_SET); @@ -874,7 +867,7 @@ writevoid(vp, loc) } long -allocvoid() +allocvoid(void) { long loc = 0L; /* location of new energy void */ diff --git a/phantasia/io.c b/phantasia/io.c index 9cff2e43..1f9d330f 100644 --- a/phantasia/io.c +++ b/phantasia/io.c @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.11 2007/12/15 19:44:42 perry Exp $ */ +/* $NetBSD: io.c,v 1.12 2009/05/25 23:08:45 dholland Exp $ */ /* * io.c - input/output routines for Phantasia @@ -10,9 +10,7 @@ #include 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 */ @@ -62,15 +60,14 @@ getstring(cp, mx) } void -more(where) - int where; +more(int where) { mvaddstr(where, 0, "-- more --"); getanswer(" ", FALSE); } double -infloat() +infloat(void) { double result; /* return value */ @@ -83,7 +80,7 @@ infloat() } int -inputoption() +inputoption(void) { ++Player.p_age; /* increase age */ @@ -99,7 +96,7 @@ inputoption() } void -interrupt() +interrupt(void) { char line[81]; /* a place to store data already on screen */ int loop; /* counter */ @@ -155,9 +152,7 @@ interrupt() } int -getanswer(choices, def) - const char *choices; - phbool def; +getanswer(const char *choices, phbool def) { int ch; /* input */ volatile int loop; /* counter */ @@ -240,8 +235,7 @@ getanswer(choices, def) } void -catchalarm(dummy) - int dummy __unused; +catchalarm(int dummy __unused) { longjmp(Timeoenv, 1); } diff --git a/phantasia/main.c b/phantasia/main.c index 996622ed..d9616859 100644 --- a/phantasia/main.c +++ b/phantasia/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.17 2008/08/08 16:10:47 drochner Exp $ */ +/* $NetBSD: main.c,v 1.18 2009/05/25 23:08:45 dholland Exp $ */ /* * Phantasia 3.3.2 -- Interterminal fantasy game @@ -63,9 +63,7 @@ int main(int, char **); 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 */ @@ -270,7 +268,7 @@ main(argc, argv) } void -initialstate() +initialstate(void) { struct stat sb; @@ -321,7 +319,7 @@ initialstate() } long -rollnewplayer() +rollnewplayer(void) { int chartype; /* character type */ int ch; /* input */ @@ -411,7 +409,7 @@ rollnewplayer() } void -procmain() +procmain(void) { int ch; /* input */ double x; /* desired new x coordinate */ @@ -621,7 +619,7 @@ procmain() } void -titlelist() +titlelist(void) { FILE *fp; /* used for opening various files */ bool councilfound = FALSE; /* set if we find a member of the @@ -726,7 +724,7 @@ titlelist() } long -recallplayer() +recallplayer(void) { long loc = 0L; /* location in player file */ int loop; /* loop counter */ @@ -785,7 +783,7 @@ recallplayer() } void -neatstuff() +neatstuff(void) { double temp; /* for temporary calculations */ int ch; /* input */ @@ -887,8 +885,7 @@ neatstuff() } void -genchar(type) - int type; +genchar(int type) { int subscript; /* used for subscripting into Stattable */ const struct charstats *statptr; /* for pointing into Stattable */ @@ -924,7 +921,7 @@ genchar(type) } void -playinit() +playinit(void) { /* catch/ingnore signals */ @@ -1007,8 +1004,7 @@ playinit() } void -cleanup(doexit) - int doexit; +cleanup(int doexit) { if (Windows) { move(LINES - 2, 0); diff --git a/phantasia/misc.c b/phantasia/misc.c index cfc8a1b1..c8f9c1e2 100644 --- a/phantasia/misc.c +++ b/phantasia/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.15 2008/01/28 06:20:15 dholland Exp $ */ +/* $NetBSD: misc.c,v 1.16 2009/05/25 23:08:45 dholland Exp $ */ /* * misc.c Phantasia miscellaneous support routines @@ -10,7 +10,7 @@ void -movelevel() +movelevel(void) { const struct charstats *statptr; /* for pointing into Stattable */ double new; /* new level */ @@ -63,9 +63,7 @@ movelevel() } const char * -descrlocation(playerp, shortflag) - struct player *playerp; - phbool shortflag; +descrlocation(struct player *playerp, phbool shortflag) { double circle; /* corresponding circle for coordinates */ int quadrant; /* quandrant of grid */ @@ -143,7 +141,7 @@ descrlocation(playerp, shortflag) } void -tradingpost() +tradingpost(void) { double numitems; /* number of items to purchase */ double cost; /* cost of purchase */ @@ -400,7 +398,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", @@ -412,7 +410,7 @@ displaystats() } void -allstatslist() +allstatslist(void) { static const char *const flags[] = /* to print value of some bools */ { @@ -445,9 +443,7 @@ allstatslist() } const char * -descrtype(playerp, shortflag) - struct player *playerp; - phbool shortflag; +descrtype(struct player *playerp, phbool shortflag) { int type; /* for caluculating result subscript */ static const char *const results[] =/* description table */ @@ -509,9 +505,7 @@ descrtype(playerp, shortflag) } long -findname(name, playerp) - const char *name; - struct player *playerp; +findname(const char *name, struct player *playerp) { long loc = 0; /* location in the file */ @@ -529,7 +523,7 @@ findname(name, playerp) } long -allocrecord() +allocrecord(void) { long loc = 0L; /* location in file */ @@ -551,9 +545,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; @@ -561,7 +553,7 @@ freerecord(playerp, loc) } void -leavegame() +leavegame(void) { if (Player.p_level < 1.0) @@ -577,8 +569,7 @@ leavegame() } void -death(how) - const char *how; +death(const char *how) { FILE *fp; /* for updating various files */ int ch; /* input */ @@ -682,9 +673,7 @@ death(how) } void -writerecord(playerp, place) - struct player *playerp; - long place; +writerecord(struct player *playerp, long place) { fseek(Playersfp, place, SEEK_SET); fwrite((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp); @@ -692,8 +681,7 @@ writerecord(playerp, place) } double -explevel(experience) - double experience; +explevel(double experience) { if (experience < 1.1e7) return (floor(pow((experience / 1000.0), 0.4875))); @@ -702,8 +690,7 @@ explevel(experience) } void -truncstring(string) - char *string; +truncstring(char *string) { int length; /* length of string */ @@ -713,10 +700,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 */ @@ -766,16 +750,14 @@ 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((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp); } void -adjuststats() +adjuststats(void) { double dtemp; /* for temporary calculations */ @@ -866,8 +848,7 @@ adjuststats() } void -initplayer(playerp) - struct player *playerp; +initplayer(struct player *playerp) { playerp->p_experience = playerp->p_level = @@ -926,7 +907,7 @@ initplayer(playerp) } void -readmessage() +readmessage(void) { move(3, 0); clrtoeol(); @@ -936,8 +917,7 @@ readmessage() } void -error(whichfile) - const char *whichfile; +error(const char *whichfile) { int (*funcp)(const char *,...); @@ -954,8 +934,7 @@ error(whichfile) } double -distance(x_1, x_2, y_1, y_2) - double x_1, x_2, y_1, y_2; +distance(double x_1, double x_2, double y_1, double y_2) { double deltax, deltay; @@ -965,8 +944,7 @@ distance(x_1, x_2, y_1, y_2) } void -ill_sig(whichsig) - int whichsig; +ill_sig(int whichsig) { clear(); if (!(whichsig == SIGINT || whichsig == SIGQUIT)) @@ -976,8 +954,7 @@ ill_sig(whichsig) } const char * -descrstatus(playerp) - struct player *playerp; +descrstatus(struct player *playerp) { switch (playerp->p_status) { case S_PLAYING: @@ -1013,7 +990,7 @@ descrstatus(playerp) } double -drandom() +drandom(void) { if (sizeof(int) != 2) /* use only low bits */ @@ -1023,9 +1000,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 */ diff --git a/phantasia/setup.c b/phantasia/setup.c index b192e847..1d5f9514 100644 --- a/phantasia/setup.c +++ b/phantasia/setup.c @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.18 2008/01/16 23:23:25 lukem Exp $ */ +/* $NetBSD: setup.c,v 1.19 2009/05/25 23:08:45 dholland Exp $ */ /* * setup.c - set up all files for Phantasia @@ -68,9 +68,7 @@ static const char *const files[] = { /* all files to create */ const char *monsterfile = "monsters.asc"; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { const char *const *filename; /* for pointing to file names */ int fd; /* file descriptor */ @@ -229,8 +227,7 @@ main(argc, argv) / ************************************************************************/ void -Error(str, file) - const char *str, *file; +Error(const char *str, const char *file) { fprintf(stderr, "Error: "); fprintf(stderr, str, file); @@ -262,7 +259,7 @@ Error(str, file) / ************************************************************************/ double -drandom() +drandom(void) { if (sizeof(int) != 2) return((double) (random() & 0x7fff) / 32768.0); -- cgit v1.2.3-56-ge451