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:
36
src/apply.c
36
src/apply.c
@@ -331,8 +331,8 @@ use_stethoscope(struct obj *obj)
|
||||
if (!getdir((char *) 0))
|
||||
return ECMD_CANCEL;
|
||||
|
||||
res = (gh.hero_seq == gc.context.stethoscope_seq) ? ECMD_TIME : ECMD_OK;
|
||||
gc.context.stethoscope_seq = gh.hero_seq;
|
||||
res = (gh.hero_seq == svc.context.stethoscope_seq) ? ECMD_TIME : ECMD_OK;
|
||||
svc.context.stethoscope_seq = gh.hero_seq;
|
||||
|
||||
gb.bhitpos.x = u.ux, gb.bhitpos.y = u.uy; /* tentative, reset below */
|
||||
gn.notonhead = u.uswallow;
|
||||
@@ -1208,9 +1208,9 @@ use_bell(struct obj **optr)
|
||||
} else if (ordinary) {
|
||||
if (obj->cursed && !rn2(4)
|
||||
/* note: once any of them are gone, we stop all of them */
|
||||
&& !(gm.mvitals[PM_WOOD_NYMPH].mvflags & G_GONE)
|
||||
&& !(gm.mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
|
||||
&& !(gm.mvitals[PM_MOUNTAIN_NYMPH].mvflags & G_GONE)
|
||||
&& !(svm.mvitals[PM_WOOD_NYMPH].mvflags & G_GONE)
|
||||
&& !(svm.mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
|
||||
&& !(svm.mvitals[PM_MOUNTAIN_NYMPH].mvflags & G_GONE)
|
||||
&& (mtmp = makemon(mkclass(S_NYMPH, 0), u.ux, u.uy,
|
||||
NO_MINVENT | MM_NOMSG)) != 0) {
|
||||
You("summon %s!", a_monnam(mtmp));
|
||||
@@ -1254,7 +1254,7 @@ use_bell(struct obj **optr)
|
||||
|
||||
} else if (invoking) {
|
||||
pline("%s an unsettling shrill sound...", Tobjnam(obj, "issue"));
|
||||
obj->age = gm.moves;
|
||||
obj->age = svm.moves;
|
||||
learno = TRUE;
|
||||
wakem = TRUE;
|
||||
|
||||
@@ -2391,7 +2391,7 @@ fig_transform(anything *arg, long timeout)
|
||||
impossible("null figurine in fig_transform()");
|
||||
return;
|
||||
}
|
||||
silent = (timeout != gm.moves); /* happened while away */
|
||||
silent = (timeout != svm.moves); /* happened while away */
|
||||
okay_spot = get_obj_location(figurine, &cc.x, &cc.y, 0);
|
||||
if (figurine->where == OBJ_INVENT || figurine->where == OBJ_MINVENT)
|
||||
okay_spot = enexto(&cc, cc.x, cc.y, &mons[figurine->corpsenm]);
|
||||
@@ -2406,7 +2406,7 @@ fig_transform(anything *arg, long timeout)
|
||||
mtmp = make_familiar(figurine, cc.x, cc.y, TRUE);
|
||||
if (mtmp) {
|
||||
char and_vanish[BUFSZ];
|
||||
struct obj *mshelter = gl.level.objects[mtmp->mx][mtmp->my];
|
||||
struct obj *mshelter = svl.level.objects[mtmp->mx][mtmp->my];
|
||||
|
||||
/* [m_monnam() yields accurate mon type, overriding hallucination] */
|
||||
Sprintf(monnambuf, "%s", an(m_monnam(mtmp)));
|
||||
@@ -2535,7 +2535,7 @@ use_figurine(struct obj **optr)
|
||||
return ECMD_OK;
|
||||
}
|
||||
if (!getdir((char *) 0)) {
|
||||
gc.context.move = gm.multi = 0;
|
||||
svc.context.move = gm.multi = 0;
|
||||
return ECMD_CANCEL;
|
||||
}
|
||||
x = u.ux + u.dx;
|
||||
@@ -3018,7 +3018,7 @@ use_whip(struct obj *obj)
|
||||
/* Have a shot at snaring something on the floor. A flyer
|
||||
can reach the floor so could just pick an item up, but
|
||||
allow snagging by whip too. */
|
||||
otmp = gl.level.objects[u.ux][u.uy];
|
||||
otmp = svl.level.objects[u.ux][u.uy];
|
||||
if (otmp && otmp->otyp == CORPSE
|
||||
&& (otmp->corpsenm == PM_HORSE
|
||||
|| otmp->corpsenm == little_to_big(PM_HORSE) /* warhorse */
|
||||
@@ -3340,7 +3340,7 @@ use_pole(struct obj *obj, boolean autohit)
|
||||
int res = ECMD_OK, typ, max_range, min_range, glyph;
|
||||
coord cc;
|
||||
struct monst *mtmp;
|
||||
struct monst *hitm = gc.context.polearm.hitmon;
|
||||
struct monst *hitm = svc.context.polearm.hitmon;
|
||||
|
||||
/* Are you allowed to use the pole? */
|
||||
if (u.uswallow) {
|
||||
@@ -3421,19 +3421,19 @@ use_pole(struct obj *obj, boolean autohit)
|
||||
return ECMD_FAIL;
|
||||
}
|
||||
|
||||
gc.context.polearm.hitmon = (struct monst *) 0;
|
||||
svc.context.polearm.hitmon = (struct monst *) 0;
|
||||
/* Attack the monster there */
|
||||
gb.bhitpos = cc;
|
||||
if ((mtmp = m_at(gb.bhitpos.x, gb.bhitpos.y)) != (struct monst *) 0) {
|
||||
if (attack_checks(mtmp, uwep)) /* can attack proceed? */
|
||||
/* no, abort the attack attempt; result depends on
|
||||
res: 1 => polearm became wielded, 0 => already wielded;
|
||||
gc.context.move: 1 => discovered hidden monster at target spot,
|
||||
svc.context.move: 1 => discovered hidden monster at target spot,
|
||||
0 => answered 'n' to "Really attack?" prompt */
|
||||
return res | (gc.context.move ? ECMD_TIME : ECMD_OK);
|
||||
return res | (svc.context.move ? ECMD_TIME : ECMD_OK);
|
||||
if (overexertion())
|
||||
return ECMD_TIME; /* burn nutrition; maybe pass out */
|
||||
gc.context.polearm.hitmon = mtmp;
|
||||
svc.context.polearm.hitmon = mtmp;
|
||||
check_caitiff(mtmp);
|
||||
gn.notonhead = (gb.bhitpos.x != mtmp->mx || gb.bhitpos.y != mtmp->my);
|
||||
(void) thitmonst(mtmp, uwep);
|
||||
@@ -3733,7 +3733,7 @@ use_grapple(struct obj *obj)
|
||||
/* FIXME -- untrap needs to deal with non-adjacent traps */
|
||||
break;
|
||||
case 1: /* Object */
|
||||
if ((otmp = gl.level.objects[cc.x][cc.y]) != 0) {
|
||||
if ((otmp = svl.level.objects[cc.x][cc.y]) != 0) {
|
||||
You("snag an object from the %s!", surface(cc.x, cc.y));
|
||||
(void) pickup_object(otmp, 1L, FALSE);
|
||||
/* If pickup fails, leave it alone */
|
||||
@@ -3992,7 +3992,7 @@ do_break_wand(struct obj *obj)
|
||||
(void) bhitm(mon, obj);
|
||||
/* if (disp.botl) bot(); */
|
||||
}
|
||||
if (affects_objects && gl.level.objects[x][y]) {
|
||||
if (affects_objects && svl.level.objects[x][y]) {
|
||||
(void) bhitpile(obj, bhito, x, y, 0);
|
||||
if (disp.botl)
|
||||
bot(); /* potion effects */
|
||||
@@ -4010,7 +4010,7 @@ do_break_wand(struct obj *obj)
|
||||
* of obj->bypass in the zap code to accomplish that last case
|
||||
* since it's also used by retouch_equipment() for polyself.)
|
||||
*/
|
||||
if (affects_objects && gl.level.objects[x][y]) {
|
||||
if (affects_objects && svl.level.objects[x][y]) {
|
||||
(void) bhitpile(obj, bhito, x, y, 0);
|
||||
if (disp.botl)
|
||||
bot(); /* potion effects */
|
||||
|
||||
Reference in New Issue
Block a user