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:
@@ -109,7 +109,7 @@ set_uasmon(void)
|
||||
which won't be known during the restore process: but BFlying
|
||||
and BStealth should be set correctly already in that case, so
|
||||
there's nothing to do */
|
||||
if (!gp.program_state.restoring)
|
||||
if (!svp.program_state.restoring)
|
||||
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
|
||||
polysense();
|
||||
|
||||
@@ -228,11 +228,11 @@ polyman(const char *fmt, const char *arg)
|
||||
struct kinfo *kptr = find_delayed_killer(POLYMORPH);
|
||||
|
||||
if (kptr != (struct kinfo *) 0 && kptr->name[0]) {
|
||||
gk.killer.format = kptr->format;
|
||||
Strcpy(gk.killer.name, kptr->name);
|
||||
svk.killer.format = kptr->format;
|
||||
Strcpy(svk.killer.name, kptr->name);
|
||||
} else {
|
||||
gk.killer.format = KILLED_BY;
|
||||
Strcpy(gk.killer.name, "self-genocide");
|
||||
svk.killer.format = KILLED_BY;
|
||||
Strcpy(svk.killer.name, "self-genocide");
|
||||
}
|
||||
dealloc_killer(kptr);
|
||||
done(GENOCIDED);
|
||||
@@ -275,9 +275,9 @@ change_sex(void)
|
||||
u.mfemale = !u.mfemale;
|
||||
max_rank_sz(); /* [this appears to be superfluous] */
|
||||
if ((Upolyd ? u.mfemale : flags.female) && gu.urole.name.f)
|
||||
Strcpy(gp.pl_character, gu.urole.name.f);
|
||||
Strcpy(svp.pl_character, gu.urole.name.f);
|
||||
else
|
||||
Strcpy(gp.pl_character, gu.urole.name.m);
|
||||
Strcpy(svp.pl_character, gu.urole.name.m);
|
||||
if (!Upolyd) {
|
||||
u.umonnum = u.umonster;
|
||||
} else if (u.umonnum == PM_AMOROUS_DEMON) {
|
||||
@@ -413,8 +413,8 @@ newman(void)
|
||||
dead: /* we come directly here if experience level went to 0 or less */
|
||||
urgent_pline(
|
||||
"Your new form doesn't seem healthy enough to survive.");
|
||||
gk.killer.format = KILLED_BY_AN;
|
||||
Strcpy(gk.killer.name, "unsuccessful polymorph");
|
||||
svk.killer.format = KILLED_BY_AN;
|
||||
Strcpy(svk.killer.name, "unsuccessful polymorph");
|
||||
done(DIED);
|
||||
/* must have been life-saved to get here */
|
||||
newuhs(FALSE);
|
||||
@@ -617,7 +617,7 @@ polyself(int psflags)
|
||||
if (draconian) {
|
||||
do_merge:
|
||||
mntmp = armor_to_dragon(uarm->otyp);
|
||||
if (!(gm.mvitals[mntmp].mvflags & G_GENOD)) {
|
||||
if (!(svm.mvitals[mntmp].mvflags & G_GENOD)) {
|
||||
unsigned was_lit = uarm->lamplit;
|
||||
int arm_light = artifact_light(uarm) ? arti_light_radius(uarm)
|
||||
: 0;
|
||||
@@ -729,7 +729,7 @@ polymon(int mntmp)
|
||||
was_hiding_under = u.uundetected && hides_under(gy.youmonst.data);
|
||||
int mlvl, newMaxStr;
|
||||
|
||||
if (gm.mvitals[mntmp].mvflags & G_GENOD) { /* allow G_EXTINCT */
|
||||
if (svm.mvitals[mntmp].mvflags & G_GENOD) { /* allow G_EXTINCT */
|
||||
You_feel("rather %s-ish.",
|
||||
pmname(&mons[mntmp], flags.female ? FEMALE : MALE));
|
||||
exercise(A_WIS, TRUE);
|
||||
@@ -1346,8 +1346,8 @@ rehumanize(void)
|
||||
/* You can't revert back while unchanging */
|
||||
if (Unchanging) {
|
||||
if (u.mh < 1) {
|
||||
gk.killer.format = NO_KILLER_PREFIX;
|
||||
Strcpy(gk.killer.name, "killed while stuck in creature form");
|
||||
svk.killer.format = NO_KILLER_PREFIX;
|
||||
Strcpy(svk.killer.name, "killed while stuck in creature form");
|
||||
done(DIED);
|
||||
/* can get to here if declining to die in explore or wizard
|
||||
mode; since we're wearing an amulet of unchanging we can't
|
||||
@@ -1373,9 +1373,9 @@ rehumanize(void)
|
||||
/* can only happen if some bit of code reduces u.uhp
|
||||
instead of u.mh while poly'd */
|
||||
Your("old form was not healthy enough to survive.");
|
||||
Sprintf(gk.killer.name, "reverting to unhealthy %s form",
|
||||
Sprintf(svk.killer.name, "reverting to unhealthy %s form",
|
||||
gu.urace.adj);
|
||||
gk.killer.format = KILLED_BY;
|
||||
svk.killer.format = KILLED_BY;
|
||||
done(DIED);
|
||||
}
|
||||
nomul(0);
|
||||
@@ -1732,8 +1732,8 @@ dogaze(void)
|
||||
l_monnam(mtmp));
|
||||
/* as if gazing at a sleeping anything is fruitful... */
|
||||
urgent_pline("You turn to stone...");
|
||||
gk.killer.format = KILLED_BY;
|
||||
Strcpy(gk.killer.name,
|
||||
svk.killer.format = KILLED_BY;
|
||||
Strcpy(svk.killer.name,
|
||||
"deliberately meeting Medusa's gaze");
|
||||
done(STONING);
|
||||
}
|
||||
@@ -1781,7 +1781,7 @@ dohide(void)
|
||||
}
|
||||
if (hides_under(gy.youmonst.data)) {
|
||||
long ct = 0L;
|
||||
struct obj *otmp, *otop = gl.level.objects[u.ux][u.uy];
|
||||
struct obj *otmp, *otop = svl.level.objects[u.ux][u.uy];
|
||||
|
||||
if (!otop) {
|
||||
There("is nothing to hide under here.");
|
||||
@@ -2210,9 +2210,9 @@ polysense(void)
|
||||
{
|
||||
short warnidx = NON_PM;
|
||||
|
||||
gc.context.warntype.speciesidx = NON_PM;
|
||||
gc.context.warntype.species = 0;
|
||||
gc.context.warntype.polyd = 0;
|
||||
svc.context.warntype.speciesidx = NON_PM;
|
||||
svc.context.warntype.species = 0;
|
||||
svc.context.warntype.polyd = 0;
|
||||
HWarn_of_mon &= ~FROMRACE;
|
||||
|
||||
switch (u.umonnum) {
|
||||
@@ -2222,13 +2222,13 @@ polysense(void)
|
||||
break;
|
||||
case PM_VAMPIRE:
|
||||
case PM_VAMPIRE_LEADER:
|
||||
gc.context.warntype.polyd = M2_HUMAN | M2_ELF;
|
||||
svc.context.warntype.polyd = M2_HUMAN | M2_ELF;
|
||||
HWarn_of_mon |= FROMRACE;
|
||||
return;
|
||||
}
|
||||
if (ismnum(warnidx)) {
|
||||
gc.context.warntype.speciesidx = warnidx;
|
||||
gc.context.warntype.species = &mons[warnidx];
|
||||
svc.context.warntype.speciesidx = warnidx;
|
||||
svc.context.warntype.species = &mons[warnidx];
|
||||
HWarn_of_mon |= FROMRACE;
|
||||
}
|
||||
}
|
||||
@@ -2237,8 +2237,8 @@ polysense(void)
|
||||
boolean
|
||||
ugenocided(void)
|
||||
{
|
||||
return ((gm.mvitals[gu.urole.mnum].mvflags & G_GENOD)
|
||||
|| (gm.mvitals[gu.urace.mnum].mvflags & G_GENOD));
|
||||
return ((svm.mvitals[gu.urole.mnum].mvflags & G_GENOD)
|
||||
|| (svm.mvitals[gu.urace.mnum].mvflags & G_GENOD));
|
||||
}
|
||||
|
||||
/* how hero feels "inside" after self-genocide of role or race */
|
||||
|
||||
Reference in New Issue
Block a user