X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/04f4d7044367099914cf1906ae27ac20c24e44cf..d6817e1fbd2e010cc8d517dac834003de3e45e22:/phantasia/misc.c diff --git a/phantasia/misc.c b/phantasia/misc.c index 89cd940b..cfc8a1b1 100644 --- a/phantasia/misc.c +++ b/phantasia/misc.c @@ -1,10 +1,12 @@ -/* $NetBSD: misc.c,v 1.5 1999/09/08 21:17:54 jsm Exp $ */ +/* $NetBSD: misc.c,v 1.15 2008/01/28 06:20:15 dholland Exp $ */ /* * misc.c Phantasia miscellaneous support routines */ #include "include.h" +#undef bool +#include void @@ -63,7 +65,7 @@ movelevel() const char * descrlocation(playerp, shortflag) struct player *playerp; - bool shortflag; + phbool shortflag; { double circle; /* corresponding circle for coordinates */ int quadrant; /* quandrant of grid */ @@ -426,7 +428,7 @@ allstatslist() mvprintw(13, 0, "Sin : %9.5f", Player.p_sin); mvprintw(14, 0, "Poison : %9.5f", Player.p_poison); mvprintw(15, 0, "Gems : %9.0f", Player.p_gems); - mvprintw(16, 0, "Age : %9d", Player.p_age); + mvprintw(16, 0, "Age : %9ld", Player.p_age); mvprintw(10, 40, "Holy Water: %9d", Player.p_holywater); mvprintw(11, 40, "Amulets : %9d", Player.p_amulets); mvprintw(12, 40, "Charms : %9d", Player.p_charms); @@ -445,7 +447,7 @@ allstatslist() const char * descrtype(playerp, shortflag) struct player *playerp; - bool shortflag; + phbool shortflag; { int type; /* for caluculating result subscript */ static const char *const results[] =/* description table */ @@ -513,7 +515,7 @@ findname(name, playerp) { long loc = 0; /* location in the file */ - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); while (fread((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) { if (strcmp(playerp->p_name, name) == 0) { if (playerp->p_status != S_NOTUSED || Wizard) @@ -531,7 +533,7 @@ allocrecord() { long loc = 0L; /* location in file */ - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) { if (Other.p_status == S_NOTUSED) /* found an empty record */ @@ -638,10 +640,10 @@ death(how) { mvaddstr(4, 0, "Your ring has taken control of you and turned you into a monster!\n"); - fseek(Monstfp, 13L * SZ_MONSTERSTRUCT, 0); + fseek(Monstfp, 13L * SZ_MONSTERSTRUCT, SEEK_SET); fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp); strcpy(Curmonster.m_name, Player.p_name); - fseek(Monstfp, 13L * SZ_MONSTERSTRUCT, 0); + fseek(Monstfp, 13L * SZ_MONSTERSTRUCT, SEEK_SET); fwrite((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp); fflush(Monstfp); } @@ -671,7 +673,7 @@ death(how) if (ch == 'Y') { cleanup(FALSE); execl(_PATH_GAMEPROG, "phantasia", "-s", - (Wizard ? "-S" : (char *) NULL), 0); + (Wizard ? "-S" : (char *) NULL), (char *) NULL); exit(0); /* NOTREACHED */ } @@ -684,7 +686,7 @@ writerecord(playerp, place) struct player *playerp; long place; { - fseek(Playersfp, place, 0); + fseek(Playersfp, place, SEEK_SET); fwrite((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp); fflush(Playersfp); } @@ -768,7 +770,7 @@ readrecord(playerp, loc) struct player *playerp; long loc; { - fseek(Playersfp, loc, 0); + fseek(Playersfp, loc, SEEK_SET); fread((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp); } @@ -790,7 +792,7 @@ adjuststats() /* calculate effective quickness */ dtemp = ((Player.p_gold + Player.p_gems / 2.0) - 1000.0) / Statptr->c_goldtote - - Player.p_level;; + - Player.p_level; dtemp = MAX(0.0, dtemp);/* gold slows player down */ Player.p_speed = Player.p_quickness + Player.p_quksilver - dtemp; @@ -928,7 +930,7 @@ readmessage() { move(3, 0); clrtoeol(); - fseek(Messagefp, 0L, 0); + fseek(Messagefp, 0L, SEEK_SET); if (fgets(Databuf, SZ_DATABUF, Messagefp) != NULL) addstr(Databuf); } @@ -937,7 +939,7 @@ void error(whichfile) const char *whichfile; { - int (*funcp) __P((const char *,...)); + int (*funcp)(const char *,...); if (Windows) { funcp = printw; @@ -945,20 +947,20 @@ error(whichfile) } else funcp = printf; - (*funcp) ("An unrecoverable error has occurred reading %s. (errno = %d)\n", whichfile, errno); + (*funcp) ("An unrecoverable error has occurred reading %s. (%s)\n", whichfile, strerror(errno)); (*funcp) ("Please run 'setup' to determine the problem.\n"); cleanup(TRUE); /* NOTREACHED */ } double -distance(x1, x2, y1, y2) - double x1, x2, y1, y2; +distance(x_1, x_2, y_1, y_2) + double x_1, x_2, y_1, y_2; { double deltax, deltay; - deltax = x1 - x2; - deltay = y1 - y2; + deltax = x_1 - x_2; + deltay = y_1 - y_2; return (sqrt(deltax * deltax + deltay * deltay)); } @@ -1064,7 +1066,7 @@ collecttaxes(gold, gems) dtemp = 0.0; fread((char *) &dtemp, sizeof(double), 1, fp); dtemp += floor(taxes); - fseek(fp, 0L, 0); + fseek(fp, 0L, SEEK_SET); fwrite((char *) &dtemp, sizeof(double), 1, fp); fclose(fp); }