diff options
author | jsm <jsm@NetBSD.org> | 1999-09-08 21:57:16 +0000 |
---|---|---|
committer | jsm <jsm@NetBSD.org> | 1999-09-08 21:57:16 +0000 |
commit | 56b3b679266d099eba0ac4e8282b239c652357c3 (patch) | |
tree | 7e3a0748576fc3fd8c50331f1d419996a73538fd /phantasia | |
parent | 82852318e37fa7eddacc3dd162a2d16d3a7487b9 (diff) | |
download | bsdgames-darwin-56b3b679266d099eba0ac4e8282b239c652357c3.tar.gz bsdgames-darwin-56b3b679266d099eba0ac4e8282b239c652357c3.tar.zst bsdgames-darwin-56b3b679266d099eba0ac4e8282b239c652357c3.zip |
Use the symbolic names `SEEK_SET' and `O_RDONLY' where appropriate in
the games.
Diffstat (limited to 'phantasia')
-rw-r--r-- | phantasia/fight.c | 6 | ||||
-rw-r--r-- | phantasia/gamesupport.c | 10 | ||||
-rw-r--r-- | phantasia/interplayer.c | 24 | ||||
-rw-r--r-- | phantasia/main.c | 10 | ||||
-rw-r--r-- | phantasia/misc.c | 18 |
5 files changed, 34 insertions, 34 deletions
diff --git a/phantasia/fight.c b/phantasia/fight.c index 3fb9c6bf..f23c37a5 100644 --- a/phantasia/fight.c +++ b/phantasia/fight.c @@ -1,4 +1,4 @@ -/* $NetBSD: fight.c,v 1.4 1998/08/30 09:19:39 veego Exp $ */ +/* $NetBSD: fight.c,v 1.5 1999/09/08 21:57:18 jsm Exp $ */ /* * fight.c Phantasia monster fighting routines @@ -844,7 +844,7 @@ callmonster(which) which = MIN(which, 99); /* make sure within range */ /* fill structure */ - fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, 0); + fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, SEEK_SET); fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp); /* handle some special monsters */ @@ -879,7 +879,7 @@ callmonster(which) /* pick another name */ { which = (int) ROLL(0.0, 100.0); - fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, 0); + fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, SEEK_SET); fread(&Othermonster, SZ_MONSTERSTRUCT, 1, Monstfp); strcpy(Curmonster.m_name, Othermonster.m_name); } diff --git a/phantasia/gamesupport.c b/phantasia/gamesupport.c index dbb3f0fd..6c6d8044 100644 --- a/phantasia/gamesupport.c +++ b/phantasia/gamesupport.c @@ -1,4 +1,4 @@ -/* $NetBSD: gamesupport.c,v 1.5 1999/09/08 21:17:53 jsm Exp $ */ +/* $NetBSD: gamesupport.c,v 1.6 1999/09/08 21:57:19 jsm Exp $ */ /* * gamesupport.c - auxiliary routines for support of Phantasia @@ -443,7 +443,7 @@ monstlist() int count = 0; /* count in file */ puts(" #) Name Str Brain Quick Energy Exper Treas Type Flock%\n"); - fseek(Monstfp, 0L, 0); + fseek(Monstfp, 0L, SEEK_SET); while (fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp) == 1) printf("%2d) %-20.20s%4.0f %4.0f %2.0f %5.0f %5.0f %2d %2d %3.0f\n", count++, Curmonster.m_name, Curmonster.m_strength, Curmonster.m_brains, @@ -468,7 +468,7 @@ scorelist() void activelist() { - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); printf("Current characters on file are:\n\n"); while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) @@ -492,7 +492,7 @@ purgeoldplayers() today = localtime(<ime)->tm_yday; for (;;) { - fseek(Playersfp, loc, 0); + fseek(Playersfp, loc, SEEK_SET); if (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) != 1) break; @@ -543,7 +543,7 @@ enterscore() strcpy(sbuf.sb_type, descrtype(&Player, TRUE)); } /* update entry */ - fseek(fp, loc, 0); + fseek(fp, loc, SEEK_SET); fwrite((char *) &sbuf, SZ_SCORESTRUCT, 1, fp); fclose(fp); } diff --git a/phantasia/interplayer.c b/phantasia/interplayer.c index 2344e0e9..3f215463 100644 --- a/phantasia/interplayer.c +++ b/phantasia/interplayer.c @@ -1,4 +1,4 @@ -/* $NetBSD: interplayer.c,v 1.4 1999/09/08 21:17:53 jsm Exp $ */ +/* $NetBSD: interplayer.c,v 1.5 1999/09/08 21:57:19 jsm Exp $ */ /* * interplayer.c - player to player routines for Phantasia @@ -12,7 +12,7 @@ checkbattle() long foeloc = 0L; /* location in file of person to fight */ Users = 0; - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) { if (Other.p_status != S_OFF @@ -356,7 +356,7 @@ checktampered() long loc = 0L; /* location in energy void file */ /* first check for energy voids */ - fseek(Energyvoidfp, 0L, 0); + fseek(Energyvoidfp, 0L, SEEK_SET); while (fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1) if (Enrgyvoid.ev_active && Enrgyvoid.ev_x == Player.p_x @@ -508,7 +508,7 @@ tampered(what, arg1, arg2) addstr("You made to position of Valar!\n"); Player.p_specialtype = SC_VALAR; Player.p_lives = 5; - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); loc = 0L; while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) /* search for existing valar */ @@ -545,7 +545,7 @@ userlist(ingameflag) mvaddstr(8, 0, "You cannot see anyone.\n"); return; } - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); mvaddstr(8, 0, "Name X Y Lvl Type Login Status\n"); @@ -607,7 +607,7 @@ throneroom() if (Player.p_specialtype < SC_KING) /* not already king -- assumes crown */ { - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) if (Other.p_specialtype == SC_KING && Other.p_status != S_NOTUSED) /* found old king */ @@ -643,7 +643,7 @@ throneroom() fclose(fp); /* clear all energy voids; retain location of holy grail */ - fseek(Energyvoidfp, 0L, 0); + fseek(Energyvoidfp, 0L, SEEK_SET); fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp); fp = fopen(_PATH_VOID, "w"); fwrite((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, fp); @@ -718,7 +718,7 @@ dotampered() /* collect taxes */ { fread((char *) &temp1, sizeof(double), 1, fp); - fseek(fp, 0L, 0); + fseek(fp, 0L, SEEK_SET); /* clear out value */ temp2 = 0.0; fwrite((char *) &temp2, sizeof(double), 1, fp); @@ -765,7 +765,7 @@ dotampered() if (Player.p_palantir) /* need a palantir to seek */ { - fseek(Energyvoidfp, 0L, 0); + fseek(Energyvoidfp, 0L, SEEK_SET); fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp); temp1 = distance(Player.p_x, Enrgyvoid.ev_x, Player.p_y, Enrgyvoid.ev_y); temp1 += ROLL(-temp1 / 10.0, temp1 / 5.0); /* add some error */ @@ -865,10 +865,10 @@ writevoid(vp, loc) long loc; { - fseek(Energyvoidfp, loc, 0); + fseek(Energyvoidfp, loc, SEEK_SET); fwrite((char *) vp, SZ_VOIDSTRUCT, 1, Energyvoidfp); fflush(Energyvoidfp); - fseek(Energyvoidfp, 0L, 0); + fseek(Energyvoidfp, 0L, SEEK_SET); } long @@ -876,7 +876,7 @@ allocvoid() { long loc = 0L; /* location of new energy void */ - fseek(Energyvoidfp, 0L, 0); + fseek(Energyvoidfp, 0L, SEEK_SET); while (fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1) if (Enrgyvoid.ev_active) loc += SZ_VOIDSTRUCT; diff --git a/phantasia/main.c b/phantasia/main.c index efa49e05..324c634e 100644 --- a/phantasia/main.c +++ b/phantasia/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.7 1999/09/08 21:17:54 jsm Exp $ */ +/* $NetBSD: main.c,v 1.8 1999/09/08 21:57:19 jsm Exp $ */ /* * Phantasia 3.3.2 -- Interterminal fantasy game @@ -626,7 +626,7 @@ titlelist() fclose(fp); } /* search for king */ - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) if (Other.p_specialtype == SC_KING && Other.p_status != S_NOTUSED) @@ -642,7 +642,7 @@ titlelist() mvaddstr(4, 24, "There is no ruler at this time."); /* search for valar */ - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) if (Other.p_specialtype == SC_VALAR && Other.p_status != S_NOTUSED) /* found the valar */ @@ -652,7 +652,7 @@ titlelist() break; } /* search for council of the wise */ - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); Lines = 10; while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) if (Other.p_specialtype == SC_COUNCIL && Other.p_status != S_NOTUSED) @@ -671,7 +671,7 @@ titlelist() hiexp = 0.0; nxtlvl = hilvl = 0; - fseek(Playersfp, 0L, 0); + fseek(Playersfp, 0L, SEEK_SET); while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) if (Other.p_experience > hiexp && Other.p_specialtype <= SC_KING && Other.p_status != S_NOTUSED) /* highest found so far */ diff --git a/phantasia/misc.c b/phantasia/misc.c index 89cd940b..098b5888 100644 --- a/phantasia/misc.c +++ b/phantasia/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.5 1999/09/08 21:17:54 jsm Exp $ */ +/* $NetBSD: misc.c,v 1.6 1999/09/08 21:57:19 jsm Exp $ */ /* * misc.c Phantasia miscellaneous support routines @@ -513,7 +513,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 +531,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 +638,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); } @@ -684,7 +684,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 +768,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); } @@ -928,7 +928,7 @@ readmessage() { move(3, 0); clrtoeol(); - fseek(Messagefp, 0L, 0); + fseek(Messagefp, 0L, SEEK_SET); if (fgets(Databuf, SZ_DATABUF, Messagefp) != NULL) addstr(Databuf); } @@ -1064,7 +1064,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); } |