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:
50
src/read.c
50
src/read.c
@@ -1650,7 +1650,7 @@ seffect_light(struct obj **sobjp)
|
||||
} else {
|
||||
int pm = scursed ? PM_BLACK_LIGHT : PM_YELLOW_LIGHT;
|
||||
|
||||
if ((gm.mvitals[pm].mvflags & G_GONE)) {
|
||||
if ((svm.mvitals[pm].mvflags & G_GONE)) {
|
||||
pline("Tiny lights sparkle in the air momentarily.");
|
||||
} else {
|
||||
/* surround with cancelled tame lights which won't explode */
|
||||
@@ -1730,7 +1730,7 @@ seffect_amnesia(struct obj **sobjp)
|
||||
forget((!sblessed ? ALL_SPELLS : 0));
|
||||
if (Hallucination) /* Ommmmmm! */
|
||||
Your("mind releases itself from mundane concerns.");
|
||||
else if (!strncmpi(gp.plname, "Maud", 4))
|
||||
else if (!strncmpi(svp.plname, "Maud", 4))
|
||||
pline("As your mind turns inward on itself,"
|
||||
" you forget everything else.");
|
||||
else if (rn2(2))
|
||||
@@ -2003,7 +2003,7 @@ seffect_magic_mapping(struct obj **sobjp)
|
||||
int cval;
|
||||
|
||||
if (is_scroll) {
|
||||
if (gl.level.flags.nommap) {
|
||||
if (svl.level.flags.nommap) {
|
||||
Your("mind is filled with crazy lines!");
|
||||
if (Hallucination)
|
||||
pline("Wow! Modern art.");
|
||||
@@ -2024,7 +2024,7 @@ seffect_magic_mapping(struct obj **sobjp)
|
||||
gk.known = TRUE;
|
||||
}
|
||||
|
||||
if (gl.level.flags.nommap) {
|
||||
if (svl.level.flags.nommap) {
|
||||
Your("%s spins as %s blocks the spell!", body_part(HEAD),
|
||||
something);
|
||||
make_confused(HConfusion + rnd(30), FALSE);
|
||||
@@ -2472,12 +2472,12 @@ litroom(
|
||||
int rx, ry;
|
||||
|
||||
if (rnum >= 0) {
|
||||
for (rx = gr.rooms[rnum].lx - 1; rx <= gr.rooms[rnum].hx + 1; rx++)
|
||||
for (ry = gr.rooms[rnum].ly - 1;
|
||||
ry <= gr.rooms[rnum].hy + 1; ry++)
|
||||
for (rx = svr.rooms[rnum].lx - 1; rx <= svr.rooms[rnum].hx + 1; rx++)
|
||||
for (ry = svr.rooms[rnum].ly - 1;
|
||||
ry <= svr.rooms[rnum].hy + 1; ry++)
|
||||
set_lit(rx, ry,
|
||||
(genericptr_t) (on ? &is_lit : (char *) 0));
|
||||
gr.rooms[rnum].rlit = on;
|
||||
svr.rooms[rnum].rlit = on;
|
||||
}
|
||||
/* hallways remain dark on the rogue level */
|
||||
} else if (is_art(obj, ART_SUNSWORD)) {
|
||||
@@ -2577,7 +2577,7 @@ do_class_genocide(void)
|
||||
if (mons[i].mlet == class) {
|
||||
if (!(mons[i].geno & G_GENO))
|
||||
immunecnt++;
|
||||
else if (gm.mvitals[i].mvflags & G_GENOD)
|
||||
else if (svm.mvitals[i].mvflags & G_GENOD)
|
||||
gonecnt++;
|
||||
else
|
||||
goodcnt++;
|
||||
@@ -2618,7 +2618,7 @@ do_class_genocide(void)
|
||||
*/
|
||||
if (Your_Own_Role(i) || Your_Own_Race(i)
|
||||
|| ((mons[i].geno & G_GENO)
|
||||
&& !(gm.mvitals[i].mvflags & G_GENOD))) {
|
||||
&& !(svm.mvitals[i].mvflags & G_GENOD))) {
|
||||
/* This check must be first since player monsters might
|
||||
* have G_GENOD or !G_GENO.
|
||||
*/
|
||||
@@ -2632,7 +2632,7 @@ do_class_genocide(void)
|
||||
def_monsyms[class].sym);
|
||||
}
|
||||
|
||||
gm.mvitals[i].mvflags |= (G_GENOD | G_NOCORPSE);
|
||||
svm.mvitals[i].mvflags |= (G_GENOD | G_NOCORPSE);
|
||||
kill_genocided_monsters();
|
||||
update_inventory(); /* eggs & tins */
|
||||
pline("Wiped out all %s.", nam);
|
||||
@@ -2665,7 +2665,7 @@ do_class_genocide(void)
|
||||
gameover = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (gm.mvitals[i].mvflags & G_GENOD) {
|
||||
} else if (svm.mvitals[i].mvflags & G_GENOD) {
|
||||
if (!gameover)
|
||||
pline("%s are already nonexistent.", upstart(nam));
|
||||
} else if (!gameover) {
|
||||
@@ -2697,8 +2697,8 @@ do_class_genocide(void)
|
||||
}
|
||||
}
|
||||
if (gameover || u.uhp == -1) {
|
||||
gk.killer.format = KILLED_BY_AN;
|
||||
Strcpy(gk.killer.name, "scroll of genocide");
|
||||
svk.killer.format = KILLED_BY_AN;
|
||||
Strcpy(svk.killer.name, "scroll of genocide");
|
||||
if (gameover)
|
||||
done(GENOCIDED);
|
||||
}
|
||||
@@ -2774,7 +2774,7 @@ do_genocide(
|
||||
}
|
||||
|
||||
mndx = name_to_mon(buf, (int *) 0);
|
||||
if (mndx == NON_PM || (gm.mvitals[mndx].mvflags & G_GENOD)) {
|
||||
if (mndx == NON_PM || (svm.mvitals[mndx].mvflags & G_GENOD)) {
|
||||
pline("Such creatures %s exist in this world.",
|
||||
(mndx == NON_PM) ? "do not" : "no longer");
|
||||
continue;
|
||||
@@ -2841,29 +2841,29 @@ do_genocide(
|
||||
livelog_printf(LL_GENOCIDE, "genocided %s", makeplural(buf));
|
||||
|
||||
/* setting no-corpse affects wishing and random tin generation */
|
||||
gm.mvitals[mndx].mvflags |= (G_GENOD | G_NOCORPSE);
|
||||
svm.mvitals[mndx].mvflags |= (G_GENOD | G_NOCORPSE);
|
||||
pline("Wiped out %s%s.", which,
|
||||
(*which != 'a') ? buf : makeplural(buf));
|
||||
|
||||
if (killplayer) {
|
||||
u.uhp = -1;
|
||||
if (how & PLAYER) {
|
||||
gk.killer.format = KILLED_BY;
|
||||
Strcpy(gk.killer.name, "genocidal confusion");
|
||||
svk.killer.format = KILLED_BY;
|
||||
Strcpy(svk.killer.name, "genocidal confusion");
|
||||
} else if (how & ONTHRONE) {
|
||||
/* player selected while on a throne */
|
||||
gk.killer.format = KILLED_BY_AN;
|
||||
Strcpy(gk.killer.name, "imperious order");
|
||||
svk.killer.format = KILLED_BY_AN;
|
||||
Strcpy(svk.killer.name, "imperious order");
|
||||
} else { /* selected player deliberately, not confused */
|
||||
gk.killer.format = KILLED_BY_AN;
|
||||
Strcpy(gk.killer.name, "scroll of genocide");
|
||||
svk.killer.format = KILLED_BY_AN;
|
||||
Strcpy(svk.killer.name, "scroll of genocide");
|
||||
}
|
||||
|
||||
/* Polymorphed characters will die as soon as they're rehumanized.
|
||||
*/
|
||||
/* KMH -- Unchanging prevents rehumanization */
|
||||
if (Upolyd && ptr != gy.youmonst.data) {
|
||||
delayed_killer(POLYMORPH, gk.killer.format, gk.killer.name);
|
||||
delayed_killer(POLYMORPH, svk.killer.format, svk.killer.name);
|
||||
You_feel("%s inside.", udeadinside());
|
||||
} else
|
||||
done(GENOCIDED);
|
||||
@@ -2876,12 +2876,12 @@ do_genocide(
|
||||
int cnt = 0, census = monster_census(FALSE);
|
||||
|
||||
if (!(mons[mndx].geno & G_UNIQ)
|
||||
&& !(gm.mvitals[mndx].mvflags & (G_GENOD | G_EXTINCT)))
|
||||
&& !(svm.mvitals[mndx].mvflags & (G_GENOD | G_EXTINCT)))
|
||||
for (i = rn1(3, 4); i > 0; i--) {
|
||||
if (!makemon(ptr, u.ux, u.uy, NO_MINVENT | MM_NOMSG))
|
||||
break; /* couldn't make one */
|
||||
++cnt;
|
||||
if (gm.mvitals[mndx].mvflags & G_EXTINCT)
|
||||
if (svm.mvitals[mndx].mvflags & G_EXTINCT)
|
||||
break; /* just made last one */
|
||||
}
|
||||
if (cnt) {
|
||||
|
||||
Reference in New Issue
Block a user