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:
@@ -510,7 +510,7 @@ restrict_name(struct obj *otmp, const char *name)
|
||||
if (!objects[otyp].oc_name_known
|
||||
&& (odesc = OBJ_DESCR(objects[otyp])) != 0) {
|
||||
obj_shuffle_range(otyp, &lo, &hi);
|
||||
for (i = gb.bases[ocls]; i < NUM_OBJECTS; i++) {
|
||||
for (i = svb.bases[ocls]; i < NUM_OBJECTS; i++) {
|
||||
if (objects[i].oc_class != ocls)
|
||||
break;
|
||||
if (!objects[i].oc_name_known
|
||||
@@ -705,7 +705,7 @@ set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
|
||||
* when restoring a game
|
||||
*/
|
||||
(void) make_hallucinated((long) !on,
|
||||
gp.program_state.restoring ? FALSE : TRUE,
|
||||
svp.program_state.restoring ? FALSE : TRUE,
|
||||
wp_mask);
|
||||
}
|
||||
if (spfx & SPFX_ESP) {
|
||||
@@ -738,10 +738,10 @@ set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
|
||||
if (spec_m2(otmp)) {
|
||||
if (on) {
|
||||
EWarn_of_mon |= wp_mask;
|
||||
gc.context.warntype.obj |= spec_m2(otmp);
|
||||
svc.context.warntype.obj |= spec_m2(otmp);
|
||||
} else {
|
||||
EWarn_of_mon &= ~wp_mask;
|
||||
gc.context.warntype.obj &= ~spec_m2(otmp);
|
||||
svc.context.warntype.obj &= ~spec_m2(otmp);
|
||||
}
|
||||
see_monsters();
|
||||
} else {
|
||||
@@ -1695,7 +1695,7 @@ arti_invoke(struct obj *obj)
|
||||
|
||||
if (oart->inv_prop > LAST_PROP) {
|
||||
/* It's a special power, not "just" a property */
|
||||
if (obj->age > gm.moves) {
|
||||
if (obj->age > svm.moves) {
|
||||
/* the artifact is tired :-) */
|
||||
You_feel("that %s %s ignoring you.", the(xname(obj)),
|
||||
otense(obj, "are"));
|
||||
@@ -1703,7 +1703,7 @@ arti_invoke(struct obj *obj)
|
||||
obj->age += (long) d(3, 10);
|
||||
return ECMD_TIME;
|
||||
}
|
||||
obj->age = gm.moves + rnz(100);
|
||||
obj->age = svm.moves + rnz(100);
|
||||
|
||||
switch (oart->inv_prop) {
|
||||
case TAMING: {
|
||||
@@ -1802,15 +1802,15 @@ arti_invoke(struct obj *obj)
|
||||
any = cg.zeroany; /* set all bits to zero */
|
||||
start_menu(tmpwin, MENU_BEHAVE_STANDARD);
|
||||
/* use index+1 (cant use 0) as identifier */
|
||||
for (i = num_ok_dungeons = 0; i < gn.n_dgns; i++) {
|
||||
if (!gd.dungeons[i].dunlev_ureached)
|
||||
for (i = num_ok_dungeons = 0; i < svn.n_dgns; i++) {
|
||||
if (!svd.dungeons[i].dunlev_ureached)
|
||||
continue;
|
||||
if (i == tutorial_dnum) /* can't portal into tutorial */
|
||||
continue;
|
||||
any.a_int = i + 1;
|
||||
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
|
||||
ATR_NONE, clr,
|
||||
gd.dungeons[i].dname, MENU_ITEMFLAGS_NONE);
|
||||
svd.dungeons[i].dname, MENU_ITEMFLAGS_NONE);
|
||||
num_ok_dungeons++;
|
||||
last_ok_dungeon = i;
|
||||
}
|
||||
@@ -1839,10 +1839,10 @@ arti_invoke(struct obj *obj)
|
||||
* The closest level is either the entry or dunlev_ureached.
|
||||
*/
|
||||
newlev.dnum = i;
|
||||
if (gd.dungeons[i].depth_start >= depth(&u.uz))
|
||||
newlev.dlevel = gd.dungeons[i].entry_lev;
|
||||
if (svd.dungeons[i].depth_start >= depth(&u.uz))
|
||||
newlev.dlevel = svd.dungeons[i].entry_lev;
|
||||
else
|
||||
newlev.dlevel = gd.dungeons[i].dunlev_ureached;
|
||||
newlev.dlevel = svd.dungeons[i].dunlev_ureached;
|
||||
|
||||
if (u.uhave.amulet || In_endgame(&u.uz) || In_endgame(&newlev)
|
||||
|| newlev.dnum == u.uz.dnum || !next_to_u()) {
|
||||
@@ -1905,7 +1905,7 @@ arti_invoke(struct obj *obj)
|
||||
if (mtmp->data->msound == MS_NEMESIS)
|
||||
continue;
|
||||
|
||||
if (In_quest(&u.uz) && !gq.quest_status.killed_nemesis)
|
||||
if (In_quest(&u.uz) && !svq.quest_status.killed_nemesis)
|
||||
chance += 10;
|
||||
if (is_dprince(mtmp->data))
|
||||
chance += 2;
|
||||
@@ -1968,7 +1968,7 @@ arti_invoke(struct obj *obj)
|
||||
} else {
|
||||
/* no direction picked */
|
||||
pline("%s", Never_mind);
|
||||
obj->age = gm.moves;
|
||||
obj->age = svm.moves;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1980,7 +1980,7 @@ arti_invoke(struct obj *obj)
|
||||
iprop = u.uprops[oart->inv_prop].intrinsic;
|
||||
boolean on = (eprop & W_ARTI) != 0; /* true if prop just set */
|
||||
|
||||
if (on && obj->age > gm.moves) {
|
||||
if (on && obj->age > svm.moves) {
|
||||
/* the artifact is tired :-) */
|
||||
u.uprops[oart->inv_prop].extrinsic ^= W_ARTI;
|
||||
You_feel("that %s %s ignoring you.", the(xname(obj)),
|
||||
@@ -1991,7 +1991,7 @@ arti_invoke(struct obj *obj)
|
||||
} else if (!on) {
|
||||
/* when turning off property, determine downtime */
|
||||
/* arbitrary for now until we can tune this -dlc */
|
||||
obj->age = gm.moves + rnz(100);
|
||||
obj->age = svm.moves + rnz(100);
|
||||
}
|
||||
|
||||
if ((eprop & ~W_ARTI) || iprop) {
|
||||
@@ -2191,7 +2191,7 @@ what_gives(long *abil)
|
||||
|
||||
for (obj = gi.invent; obj; obj = obj->nobj) {
|
||||
if (obj->oartifact
|
||||
&& (abil != &EWarn_of_mon || gc.context.warntype.obj)) {
|
||||
&& (abil != &EWarn_of_mon || svc.context.warntype.obj)) {
|
||||
const struct artifact *art = get_artifact(obj);
|
||||
|
||||
if (art != &artilist[ART_NONARTIFACT]) {
|
||||
@@ -2527,7 +2527,7 @@ count_surround_traps(coordxy x, coordxy y)
|
||||
++ret;
|
||||
continue;
|
||||
}
|
||||
for (otmp = gl.level.objects[dx][dy]; otmp; otmp = otmp->nexthere)
|
||||
for (otmp = svl.level.objects[dx][dy]; otmp; otmp = otmp->nexthere)
|
||||
if (Is_container(otmp) && otmp->otrapped) {
|
||||
++ret; /* we're counting locations, so just */
|
||||
break; /* count the first one in a pile */
|
||||
|
||||
Reference in New Issue
Block a user