remove an argument that is no longer necessary from a few functions

Passing a boolean 'ghostly' argument to some functions that are also passed
an NHFILE * is unnecessary now.
This commit is contained in:
nhmall
2020-02-02 22:54:44 -05:00
parent 56b196772e
commit 1dfab5fe11
8 changed files with 42 additions and 46 deletions

View File

@@ -2180,7 +2180,7 @@ E void FDECL(update_monster_region, (struct monst *));
E NhRegion *FDECL(visible_region_at, (XCHAR_P, XCHAR_P)); E NhRegion *FDECL(visible_region_at, (XCHAR_P, XCHAR_P));
E void FDECL(show_region, (NhRegion *, XCHAR_P, XCHAR_P)); E void FDECL(show_region, (NhRegion *, XCHAR_P, XCHAR_P));
E void FDECL(save_regions, (NHFILE *)); E void FDECL(save_regions, (NHFILE *));
E void FDECL(rest_regions, (NHFILE *, BOOLEAN_P)); E void FDECL(rest_regions, (NHFILE *));
E void FDECL(region_stats, (const char *, char *, long *, long *)); E void FDECL(region_stats, (const char *, char *, long *, long *));
E NhRegion *FDECL(create_gas_cloud, (XCHAR_P, XCHAR_P, int, int)); E NhRegion *FDECL(create_gas_cloud, (XCHAR_P, XCHAR_P, int, int));
E boolean NDECL(region_danger); E boolean NDECL(region_danger);
@@ -2192,7 +2192,7 @@ E void FDECL(inven_inuse, (BOOLEAN_P));
E int FDECL(dorecover, (NHFILE *)); E int FDECL(dorecover, (NHFILE *));
E void FDECL(restcemetery, (NHFILE *, struct cemetery **)); E void FDECL(restcemetery, (NHFILE *, struct cemetery **));
E void FDECL(trickery, (char *)); E void FDECL(trickery, (char *));
E void FDECL(getlev, (NHFILE *, int, XCHAR_P, BOOLEAN_P)); E void FDECL(getlev, (NHFILE *, int, XCHAR_P));
E void FDECL(get_plname_from_file, (NHFILE *, char *)); E void FDECL(get_plname_from_file, (NHFILE *, char *));
#ifdef SELECTSAVED #ifdef SELECTSAVED
E int FDECL(restore_menu, (winid)); E int FDECL(restore_menu, (winid));
@@ -2584,7 +2584,7 @@ E long FDECL(spot_time_expires, (XCHAR_P, XCHAR_P, SHORT_P));
E long FDECL(spot_time_left, (XCHAR_P, XCHAR_P, SHORT_P)); E long FDECL(spot_time_left, (XCHAR_P, XCHAR_P, SHORT_P));
E boolean FDECL(obj_is_local, (struct obj *)); E boolean FDECL(obj_is_local, (struct obj *));
E void FDECL(save_timers, (NHFILE *, int)); E void FDECL(save_timers, (NHFILE *, int));
E void FDECL(restore_timers, (NHFILE *, int, BOOLEAN_P, long)); E void FDECL(restore_timers, (NHFILE *, int, long));
E void FDECL(timer_stats, (const char *, char *, long *, long *)); E void FDECL(timer_stats, (const char *, char *, long *, long *));
E void FDECL(relink_timers, (BOOLEAN_P)); E void FDECL(relink_timers, (BOOLEAN_P));
E int NDECL(wiz_timeout_queue); E int NDECL(wiz_timeout_queue);

View File

@@ -645,7 +645,7 @@ getbones()
} else { } else {
register struct monst *mtmp; register struct monst *mtmp;
getlev(nhfp, 0, 0, TRUE); getlev(nhfp, 0, 0);
/* Note that getlev() now keeps tabs on unique /* Note that getlev() now keeps tabs on unique
* monsters such as demon lords, and tracks the * monsters such as demon lords, and tracks the

View File

@@ -1479,7 +1479,7 @@ boolean at_stairs, falling, portal;
reseed_random(rn2); reseed_random(rn2);
reseed_random(rn2_on_display_rng); reseed_random(rn2_on_display_rng);
minit(); /* ZEROCOMP */ minit(); /* ZEROCOMP */
getlev(nhfp, g.hackpid, new_ledger, FALSE); getlev(nhfp, g.hackpid, new_ledger);
/* when in wizard mode, it is possible to leave from and return to /* when in wizard mode, it is possible to leave from and return to
any level in the endgame; above, we discarded bubble/cloud info any level in the endgame; above, we discarded bubble/cloud info
when leaving Plane of Water or Air so recreate some now */ when leaving Plane of Water or Air so recreate some now */

View File

@@ -1101,12 +1101,7 @@ create_savefile()
nhfp->fieldlevel = FALSE; nhfp->fieldlevel = FALSE;
nhfp->ftype = NHF_SAVEFILE; nhfp->ftype = NHF_SAVEFILE;
nhfp->mode = WRITING; nhfp->mode = WRITING;
#ifdef SYSCF if (g.program_state.in_self_recover || do_historical) {
if (sysopt.saveformat[0] > historical &&
sysopt.saveformat[0] <= ascii)
do_historical = FALSE;
#endif /* SYSCF */
if (g.program_state.in_self_recover) {
do_historical = TRUE; /* force it */ do_historical = TRUE; /* force it */
nhfp->structlevel = TRUE; nhfp->structlevel = TRUE;
nhfp->fieldlevel = FALSE; nhfp->fieldlevel = FALSE;
@@ -1162,7 +1157,7 @@ open_savefile()
nhfp->fieldlevel = FALSE; nhfp->fieldlevel = FALSE;
nhfp->ftype = NHF_SAVEFILE; nhfp->ftype = NHF_SAVEFILE;
nhfp->mode = READING; nhfp->mode = READING;
if (g.program_state.in_self_recover) { if (g.program_state.in_self_recover || do_historical) {
do_historical = TRUE; /* force it */ do_historical = TRUE; /* force it */
nhfp->structlevel = TRUE; nhfp->structlevel = TRUE;
nhfp->fieldlevel = FALSE; nhfp->fieldlevel = FALSE;

View File

@@ -702,14 +702,14 @@ NHFILE *nhfp;
} }
void void
rest_regions(nhfp, ghostly) rest_regions(nhfp)
NHFILE *nhfp; NHFILE *nhfp;
boolean ghostly; /* If a bones file restore */
{ {
int i, j; int i, j;
unsigned n = 0; unsigned n = 0;
long tmstamp = 0L; long tmstamp = 0L;
char *msg_buf; char *msg_buf;
boolean ghostly = (nhfp->ftype == NHF_BONESFILE);
clear_regions(); /* Just for security */ clear_regions(); /* Just for security */
if (nhfp->structlevel) if (nhfp->structlevel)

View File

@@ -23,11 +23,11 @@ static int NDECL(zerocomp_mgetc);
static void NDECL(find_lev_obj); static void NDECL(find_lev_obj);
static void FDECL(restlevchn, (NHFILE *)); static void FDECL(restlevchn, (NHFILE *));
static void FDECL(restdamage, (NHFILE *, BOOLEAN_P)); static void FDECL(restdamage, (NHFILE *));
static void FDECL(restobj, (NHFILE *, struct obj *)); static void FDECL(restobj, (NHFILE *, struct obj *));
static struct obj *FDECL(restobjchn, (NHFILE *, BOOLEAN_P, BOOLEAN_P)); static struct obj *FDECL(restobjchn, (NHFILE *, BOOLEAN_P));
static void FDECL(restmon, (NHFILE *, struct monst *)); static void FDECL(restmon, (NHFILE *, struct monst *));
static struct monst *FDECL(restmonchn, (NHFILE *, BOOLEAN_P)); static struct monst *FDECL(restmonchn, (NHFILE *));
static struct fruit *FDECL(loadfruitchn, (NHFILE *)); static struct fruit *FDECL(loadfruitchn, (NHFILE *));
static void FDECL(freefruitchn, (struct fruit *)); static void FDECL(freefruitchn, (struct fruit *));
static void FDECL(ghostfruit, (struct obj *)); static void FDECL(ghostfruit, (struct obj *));
@@ -142,13 +142,13 @@ NHFILE *nhfp;
} }
static void static void
restdamage(nhfp, ghostly) restdamage(nhfp)
NHFILE *nhfp; NHFILE *nhfp;
boolean ghostly;
{ {
unsigned int dmgcount = 0; unsigned int dmgcount = 0;
int counter; int counter;
struct damage *tmp_dam; struct damage *tmp_dam;
boolean ghostly = (nhfp->ftype == NHF_BONESFILE);
if (nhfp->structlevel) if (nhfp->structlevel)
mread(nhfp->fd, (genericptr_t) &dmgcount, sizeof(dmgcount)); mread(nhfp->fd, (genericptr_t) &dmgcount, sizeof(dmgcount));
@@ -263,13 +263,14 @@ struct obj *otmp;
} }
static struct obj * static struct obj *
restobjchn(nhfp, ghostly, frozen) restobjchn(nhfp, frozen)
NHFILE *nhfp; NHFILE *nhfp;
boolean ghostly, frozen; boolean frozen;
{ {
register struct obj *otmp, *otmp2 = 0; register struct obj *otmp, *otmp2 = 0;
register struct obj *first = (struct obj *) 0; register struct obj *first = (struct obj *) 0;
int buflen = 0; int buflen = 0;
boolean ghostly = (nhfp->ftype == NHF_BONESFILE);
while (1) { while (1) {
if (nhfp->structlevel) if (nhfp->structlevel)
@@ -303,7 +304,7 @@ boolean ghostly, frozen;
if (Has_contents(otmp)) { if (Has_contents(otmp)) {
struct obj *otmp3; struct obj *otmp3;
otmp->cobj = restobjchn(nhfp, ghostly, Is_IceBox(otmp)); otmp->cobj = restobjchn(nhfp, Is_IceBox(otmp));
/* restore container back pointers */ /* restore container back pointers */
for (otmp3 = otmp->cobj; otmp3; otmp3 = otmp3->nobj) for (otmp3 = otmp->cobj; otmp3; otmp3 = otmp3->nobj)
otmp3->ocontainer = otmp; otmp3->ocontainer = otmp;
@@ -424,13 +425,13 @@ struct monst *mtmp;
} }
static struct monst * static struct monst *
restmonchn(nhfp, ghostly) restmonchn(nhfp)
NHFILE *nhfp; NHFILE *nhfp;
boolean ghostly;
{ {
register struct monst *mtmp, *mtmp2 = 0; register struct monst *mtmp, *mtmp2 = 0;
register struct monst *first = (struct monst *) 0; register struct monst *first = (struct monst *) 0;
int offset, buflen = 0; int offset, buflen = 0;
boolean ghostly = (nhfp->ftype == NHF_BONESFILE);
while (1) { while (1) {
if (nhfp->structlevel) if (nhfp->structlevel)
@@ -461,7 +462,7 @@ boolean ghostly;
} }
if (mtmp->minvent) { if (mtmp->minvent) {
struct obj *obj; struct obj *obj;
mtmp->minvent = restobjchn(nhfp, ghostly, FALSE); mtmp->minvent = restobjchn(nhfp, FALSE);
/* restore monster back pointer */ /* restore monster back pointer */
for (obj = mtmp->minvent; obj; obj = obj->nobj) for (obj = mtmp->minvent; obj; obj = obj->nobj)
obj->ocarry = mtmp; obj->ocarry = mtmp;
@@ -679,13 +680,13 @@ unsigned int *stuckid, *steedid;
/* this stuff comes after potential aborted restore attempts */ /* this stuff comes after potential aborted restore attempts */
restore_killers(nhfp); restore_killers(nhfp);
restore_timers(nhfp, RANGE_GLOBAL, FALSE, 0L); restore_timers(nhfp, RANGE_GLOBAL, 0L);
restore_light_sources(nhfp); restore_light_sources(nhfp);
g.invent = restobjchn(nhfp, FALSE, FALSE); g.invent = restobjchn(nhfp, FALSE);
/* restore dangling (not on floor or in inventory) ball and/or chain */ /* restore dangling (not on floor or in inventory) ball and/or chain */
bc_obj = restobjchn(nhfp, FALSE, FALSE); bc_obj = restobjchn(nhfp, FALSE);
while (bc_obj) { while (bc_obj) {
struct obj *nobj = bc_obj->nobj; struct obj *nobj = bc_obj->nobj;
@@ -694,8 +695,8 @@ unsigned int *stuckid, *steedid;
bc_obj->nobj = (struct obj *) 0; bc_obj->nobj = (struct obj *) 0;
bc_obj = nobj; bc_obj = nobj;
} }
g.migrating_objs = restobjchn(nhfp, FALSE, FALSE); g.migrating_objs = restobjchn(nhfp, FALSE);
g.migrating_mons = restmonchn(nhfp, FALSE); g.migrating_mons = restmonchn(nhfp);
if (nhfp->structlevel) { if (nhfp->structlevel) {
mread(nhfp->fd, (genericptr_t) g.mvitals, sizeof g.mvitals); mread(nhfp->fd, (genericptr_t) g.mvitals, sizeof g.mvitals);
@@ -863,7 +864,7 @@ NHFILE *nhfp;
g.restoring = TRUE; g.restoring = TRUE;
get_plname_from_file(nhfp, g.plname); get_plname_from_file(nhfp, g.plname);
getlev(nhfp, 0, (xchar) 0, FALSE); getlev(nhfp, 0, (xchar) 0);
if (!restgamestate(nhfp, &stuckid, &steedid)) { if (!restgamestate(nhfp, &stuckid, &steedid)) {
NHFILE tnhfp; NHFILE tnhfp;
@@ -925,7 +926,7 @@ NHFILE *nhfp;
if (restoreinfo.mread_flags == -1) if (restoreinfo.mread_flags == -1)
break; break;
} }
getlev(nhfp, 0, ltmp, FALSE); getlev(nhfp, 0, ltmp);
#ifdef MICRO #ifdef MICRO
curs(WIN_MAP, 1 + dotcnt++, dotrow); curs(WIN_MAP, 1 + dotcnt++, dotrow);
if (dotcnt >= (COLNO - 1)) { if (dotcnt >= (COLNO - 1)) {
@@ -946,7 +947,7 @@ NHFILE *nhfp;
(void) validate(nhfp, (char *) 0); (void) validate(nhfp, (char *) 0);
get_plname_from_file(nhfp, g.plname); get_plname_from_file(nhfp, g.plname);
getlev(nhfp, 0, (xchar) 0, FALSE); getlev(nhfp, 0, (xchar) 0);
close_nhfile(nhfp); close_nhfile(nhfp);
restlevelstate(stuckid, steedid); restlevelstate(stuckid, steedid);
g.program_state.something_worth_saving = 1; /* useful data now exists */ g.program_state.something_worth_saving = 1; /* useful data now exists */
@@ -1076,11 +1077,10 @@ char *reason;
} }
void void
getlev(nhfp, pid, lev, ghostly) getlev(nhfp, pid, lev)
NHFILE *nhfp; NHFILE *nhfp;
int pid; int pid;
xchar lev; xchar lev;
boolean ghostly;
{ {
register struct trap *trap; register struct trap *trap;
register struct monst *mtmp; register struct monst *mtmp;
@@ -1089,6 +1089,7 @@ boolean ghostly;
int hpid = 0; int hpid = 0;
xchar dlvl = 0; xchar dlvl = 0;
int x, y; int x, y;
boolean ghostly = (nhfp->ftype == NHF_BONESFILE);
#ifdef TOS #ifdef TOS
short tlev; short tlev;
#endif #endif
@@ -1157,9 +1158,9 @@ boolean ghostly;
else else
g.doorindex = 0; g.doorindex = 0;
restore_timers(nhfp, RANGE_LEVEL, ghostly, elapsed); restore_timers(nhfp, RANGE_LEVEL, elapsed);
restore_light_sources(nhfp); restore_light_sources(nhfp);
fmon = restmonchn(nhfp, ghostly); fmon = restmonchn(nhfp);
/* rest_worm(fd); */ /* restore worm information */ /* rest_worm(fd); */ /* restore worm information */
rest_worm(nhfp); /* restore worm information */ rest_worm(nhfp); /* restore worm information */
@@ -1177,12 +1178,12 @@ boolean ghostly;
} }
dealloc_trap(trap); dealloc_trap(trap);
fobj = restobjchn(nhfp, ghostly, FALSE); fobj = restobjchn(nhfp, FALSE);
find_lev_obj(); find_lev_obj();
/* restobjchn()'s `frozen' argument probably ought to be a callback /* restobjchn()'s `frozen' argument probably ought to be a callback
routine so that we can check for objects being buried under ice */ routine so that we can check for objects being buried under ice */
g.level.buriedobjlist = restobjchn(nhfp, ghostly, FALSE); g.level.buriedobjlist = restobjchn(nhfp, FALSE);
g.billobjs = restobjchn(nhfp, ghostly, FALSE); g.billobjs = restobjchn(nhfp, FALSE);
rest_engravings(nhfp); rest_engravings(nhfp);
/* reset level.monsters for new level */ /* reset level.monsters for new level */
@@ -1219,8 +1220,8 @@ boolean ghostly;
if (ghostly || (elapsed > 00 && elapsed > (long) rnd(10))) if (ghostly || (elapsed > 00 && elapsed > (long) rnd(10)))
hide_monst(mtmp); hide_monst(mtmp);
} }
restdamage(nhfp, ghostly); restdamage(nhfp);
rest_regions(nhfp, ghostly); rest_regions(nhfp);
if (ghostly) { if (ghostly) {
/* Now get rid of all the temp fruits... */ /* Now get rid of all the temp fruits... */

View File

@@ -245,7 +245,7 @@ dosave0()
return 0; return 0;
} }
minit(); /* ZEROCOMP */ minit(); /* ZEROCOMP */
getlev(onhfp, g.hackpid, ltmp, FALSE); getlev(onhfp, g.hackpid, ltmp);
close_nhfile(onhfp); close_nhfile(onhfp);
if (nhfp->structlevel) if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t) &ltmp, sizeof ltmp); /* level number*/ bwrite(nhfp->fd, (genericptr_t) &ltmp, sizeof ltmp); /* level number*/

View File

@@ -1658,7 +1658,7 @@ do_storms()
* are saved with a level. Object and monster timers are * are saved with a level. Object and monster timers are
* saved using their respective id's instead of pointers. * saved using their respective id's instead of pointers.
* *
* void restore_timers(NHFILE *, int range, boolean ghostly, long adjust) * void restore_timers(NHFILE *, int range, long adjust)
* Restore timers of range 'range'. If from a ghost pile, * Restore timers of range 'range'. If from a ghost pile,
* adjust the timeout by 'adjust'. The object and monster * adjust the timeout by 'adjust'. The object and monster
* ids are not restored until later. * ids are not restored until later.
@@ -2360,14 +2360,14 @@ int range;
* monster pointers. * monster pointers.
*/ */
void void
restore_timers(nhfp, range, ghostly, adjust) restore_timers(nhfp, range, adjust)
NHFILE *nhfp; NHFILE *nhfp;
int range; int range;
boolean ghostly; /* restoring from a ghost level */
long adjust; /* how much to adjust timeout */ long adjust; /* how much to adjust timeout */
{ {
int count = 0; int count = 0;
timer_element *curr; timer_element *curr;
boolean ghostly = (nhfp->ftype == NHF_BONESFILE); /* from a ghost level */
if (range == RANGE_GLOBAL) { if (range == RANGE_GLOBAL) {
if (nhfp->structlevel) if (nhfp->structlevel)