distinguish global variables that get written to savefile
The g? structs had a mix of variables that were written to
the savefile, and those that were not.
For better clarity and to distinguish those that end up in
the savefile, relocate some g? variables that get written
directly to the savefile into different structs.
This updates EDITLEVEL, although technically it probably
didn't need to, since savefile contents are not changing.
Details:
gb.bases -> svb.bases
gb.bbubbles -> svb.bbubbles
gb.branches -> svb.branches
gc.context -> svc.context
gd.disco -> svd.disco
gd.dndest -> svd.dndest
gd.doors -> svd.doors
gd.doors_alloc -> svd.doors_alloc
gd.dungeon_topology -> svd.dungeon_topology
gd.dungeons -> svd.dungeons
ge.exclusion_zones -> sve.exclusion_zones
gh.hackpid -> svh.hackpid
gi.inv_pos -> svi.inv_pos
gk.killer -> svk.killer
gl.lastseentyp -> svl.lastseentyp
gl.level -> svl.level
gl.level_info -> svl.level_info
gm.mapseenchn -> svm.mapseenchn
gm.moves -> svm.moves
gm.mvitals -> svm.mvitals
gn.n_dgns -> svn.n_dgns
gn.n_regions -> svn.n_regions
gn.nroom -> svn.nroom
go.oracle_cnt -> svo.oracle_cnt
gp.pl_character -> svp.pl_character
gp.pl_fruit -> svp.pl_fruit
gp.plname -> svp.plname
gp.program_state -> svp.program_state
gq.quest_status -> svq.quest_status
gr.rooms -> svr.rooms
gs.sp_levchn -> svs.sp_levchn
gs.spl_book -> svs.spl_book
gt.timer_id -> svt.timer_id
gt.tune -> svt.tune
gu.updest -> svu.updest
gx.xmax -> svx.xmax
gx.xmin -> svx.xmin
gy.ymax -> svy.ymax
gy.ymin -> svy.ymin
Related note:
There are some pointer variables that are heads of chains that were not
moved from 'g?' to 'sv?', because they are not actually written to the
savefile directly, but the objects/monst/trap/lightsource/timer in the
chains they point to are. That can be changed, if desired.
Examples: gi.invent, gm.migrating_objs, gb.billobjs, gm.migrating_mons,
gf.ftrap, gl.light_base, gt.timer_base
This commit is contained in:
38
src/dog.c
38
src/dog.c
@@ -53,7 +53,7 @@ initedog(struct monst *mtmp)
|
||||
EDOG(mtmp)->dropdist = 10000;
|
||||
EDOG(mtmp)->apport = ACURR(A_CHA);
|
||||
EDOG(mtmp)->whistletime = 0;
|
||||
EDOG(mtmp)->hungrytime = 1000 + gm.moves;
|
||||
EDOG(mtmp)->hungrytime = 1000 + svm.moves;
|
||||
EDOG(mtmp)->ogoal.x = -1; /* force error if used before set */
|
||||
EDOG(mtmp)->ogoal.y = -1;
|
||||
EDOG(mtmp)->abuse = 0;
|
||||
@@ -89,7 +89,7 @@ pick_familiar_pm(struct obj *otmp, boolean quietly)
|
||||
/* activating a figurine provides one way to exceed the
|
||||
maximum number of the target critter created--unless
|
||||
it has a special limit (erinys, Nazgul) */
|
||||
if ((gm.mvitals[mndx].mvflags & G_EXTINCT)
|
||||
if ((svm.mvitals[mndx].mvflags & G_EXTINCT)
|
||||
&& mbirth_limit(mndx) != MAXMONNO) {
|
||||
if (!quietly)
|
||||
/* have just been given "You <do something with>
|
||||
@@ -221,7 +221,7 @@ makedog(void)
|
||||
if (!mtmp)
|
||||
return ((struct monst *) 0); /* pets were genocided */
|
||||
|
||||
gc.context.startingpet_mid = mtmp->m_id;
|
||||
svc.context.startingpet_mid = mtmp->m_id;
|
||||
/* Horses already wear a saddle */
|
||||
if (pettype == PM_PONY && !!(otmp = mksobj(SADDLE, TRUE, FALSE))) {
|
||||
otmp->dknown = otmp->bknown = otmp->rknown = 1;
|
||||
@@ -238,7 +238,7 @@ makedog(void)
|
||||
staticfn void
|
||||
set_mon_lastmove(struct monst *mtmp)
|
||||
{
|
||||
mtmp->mlstmv = gm.moves;
|
||||
mtmp->mlstmv = svm.moves;
|
||||
}
|
||||
|
||||
/* record `last move time' for all monsters prior to level save so that
|
||||
@@ -432,9 +432,9 @@ mon_arrive(struct monst *mtmp, int when)
|
||||
* specify its final destination.
|
||||
*/
|
||||
|
||||
if (mtmp->mlstmv < gm.moves - 1L) {
|
||||
if (mtmp->mlstmv < svm.moves - 1L) {
|
||||
/* heal monster for time spent in limbo */
|
||||
long nmv = gm.moves - 1L - mtmp->mlstmv;
|
||||
long nmv = svm.moves - 1L - mtmp->mlstmv;
|
||||
|
||||
mon_catchup_elapsed_time(mtmp, nmv);
|
||||
|
||||
@@ -489,8 +489,8 @@ mon_arrive(struct monst *mtmp, int when)
|
||||
that we know that the current endgame levels always
|
||||
build upwards and never have any exclusion subregion
|
||||
inside their TELEPORT_REGION settings. */
|
||||
xlocale = rn1(gu.updest.hx - gu.updest.lx + 1, gu.updest.lx);
|
||||
ylocale = rn1(gu.updest.hy - gu.updest.ly + 1, gu.updest.ly);
|
||||
xlocale = rn1(svu.updest.hx - svu.updest.lx + 1, svu.updest.lx);
|
||||
ylocale = rn1(svu.updest.hy - svu.updest.ly + 1, svu.updest.ly);
|
||||
break;
|
||||
}
|
||||
/* find the arrival portal */
|
||||
@@ -529,7 +529,7 @@ mon_arrive(struct monst *mtmp, int when)
|
||||
coord c;
|
||||
|
||||
/* somexy() handles irregular rooms */
|
||||
if (somexy(&gr.rooms[*r - ROOMOFFSET], &c))
|
||||
if (somexy(&svr.rooms[*r - ROOMOFFSET], &c))
|
||||
xlocale = c.x, ylocale = c.y;
|
||||
else
|
||||
xlocale = ylocale = 0;
|
||||
@@ -642,8 +642,8 @@ mon_catchup_elapsed_time(
|
||||
&& (carnivorous(mtmp->data) || herbivorous(mtmp->data))) {
|
||||
struct edog *edog = EDOG(mtmp);
|
||||
|
||||
if ((gm.moves > edog->hungrytime + 500 && mtmp->mhp < 3)
|
||||
|| (gm.moves > edog->hungrytime + 750))
|
||||
if ((svm.moves > edog->hungrytime + 500 && mtmp->mhp < 3)
|
||||
|| (svm.moves > edog->hungrytime + 750))
|
||||
mtmp->mtame = mtmp->mpeaceful = 0;
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ keepdogs(
|
||||
relmon(mtmp, &gm.mydogs); /* mtmp->mx,my retain current value */
|
||||
mtmp->mx = mtmp->my = 0; /* mx==0 implies migrating */
|
||||
mtmp->wormno = num_segs;
|
||||
mtmp->mlstmv = gm.moves;
|
||||
mtmp->mlstmv = svm.moves;
|
||||
} else if (keep_mon_accessible(mtmp)) {
|
||||
/* we want to be able to find the Wizard when his next
|
||||
resurrection chance comes up, but have him resume his
|
||||
@@ -856,7 +856,7 @@ migrate_to_level(
|
||||
if (In_W_tower(mx, my, &u.uz))
|
||||
xyflags |= 2;
|
||||
mtmp->wormno = num_segs;
|
||||
mtmp->mlstmv = gm.moves;
|
||||
mtmp->mlstmv = svm.moves;
|
||||
mtmp->mtrack[2].x = u.uz.dnum; /* migrating from this dungeon */
|
||||
mtmp->mtrack[2].y = u.uz.dlevel; /* migrating from this dungeon level */
|
||||
mtmp->mtrack[1].x = cc ? cc->x : mx;
|
||||
@@ -974,7 +974,7 @@ dogfood(struct monst *mon, struct obj *obj)
|
||||
when starving; they never eat stone-to-flesh'd meat */
|
||||
if (mptr == &mons[PM_GHOUL]) {
|
||||
if (obj->otyp == CORPSE)
|
||||
return (peek_at_iced_corpse_age(obj) + 50L <= gm.moves
|
||||
return (peek_at_iced_corpse_age(obj) + 50L <= svm.moves
|
||||
&& !(fx == PM_LIZARD || fx == PM_LICHEN)) ? DOGFOOD
|
||||
: (starving && !vegan(fptr)) ? ACCFOOD
|
||||
: POISON;
|
||||
@@ -995,7 +995,7 @@ dogfood(struct monst *mon, struct obj *obj)
|
||||
return POISON;
|
||||
return carni ? CADAVER : MANFOOD;
|
||||
case CORPSE:
|
||||
if ((peek_at_iced_corpse_age(obj) + 50L <= gm.moves
|
||||
if ((peek_at_iced_corpse_age(obj) + 50L <= svm.moves
|
||||
&& !(fx == PM_LIZARD || fx == PM_LICHEN)
|
||||
&& mptr->mlet != S_FUNGUS)
|
||||
|| (acidic(fptr) && !resists_acid(mon))
|
||||
@@ -1117,7 +1117,7 @@ tamedog(struct monst *mtmp, struct obj *obj, boolean givemsg)
|
||||
if (mtmp->mcanmove && !mtmp->mconf && !mtmp->meating
|
||||
&& ((tasty = dogfood(mtmp, obj)) == DOGFOOD
|
||||
|| (tasty <= ACCFOOD
|
||||
&& EDOG(mtmp)->hungrytime <= gm.moves))) {
|
||||
&& EDOG(mtmp)->hungrytime <= svm.moves))) {
|
||||
/* pet will "catch" and eat this thrown food */
|
||||
if (canseemon(mtmp)) {
|
||||
boolean big_corpse =
|
||||
@@ -1161,7 +1161,7 @@ tamedog(struct monst *mtmp, struct obj *obj, boolean givemsg)
|
||||
|| (obj && dogfood(mtmp, obj) >= MANFOOD))
|
||||
return FALSE;
|
||||
|
||||
if (mtmp->m_id == gq.quest_status.leader_m_id)
|
||||
if (mtmp->m_id == svq.quest_status.leader_m_id)
|
||||
return FALSE;
|
||||
|
||||
/* add the pet extension */
|
||||
@@ -1254,8 +1254,8 @@ wary_dog(struct monst *mtmp, boolean was_dead)
|
||||
edog->killed_by_u = 0;
|
||||
edog->abuse = 0;
|
||||
edog->ogoal.x = edog->ogoal.y = -1;
|
||||
if (was_dead || edog->hungrytime < gm.moves + 500L)
|
||||
edog->hungrytime = gm.moves + 500L;
|
||||
if (was_dead || edog->hungrytime < svm.moves + 500L)
|
||||
edog->hungrytime = svm.moves + 500L;
|
||||
if (was_dead) {
|
||||
edog->droptime = 0L;
|
||||
edog->dropdist = 10000;
|
||||
|
||||
Reference in New Issue
Block a user