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:
14
src/lock.c
14
src/lock.c
@@ -192,7 +192,7 @@ breakchestlock(struct obj *box, boolean destroyit)
|
||||
useup(otmp);
|
||||
}
|
||||
if (box->otyp == ICE_BOX && otmp->otyp == CORPSE) {
|
||||
otmp->age = gm.moves - otmp->age; /* actual age */
|
||||
otmp->age = svm.moves - otmp->age; /* actual age */
|
||||
start_corpse_timeout(otmp);
|
||||
}
|
||||
place_object(otmp, u.ux, u.uy);
|
||||
@@ -441,7 +441,7 @@ pick_lock(
|
||||
|
||||
count = 0;
|
||||
c = 'n'; /* in case there are no boxes here */
|
||||
for (otmp = gl.level.objects[cc.x][cc.y]; otmp;
|
||||
for (otmp = svl.level.objects[cc.x][cc.y]; otmp;
|
||||
otmp = otmp->nexthere) {
|
||||
/* autounlock on boxes: only the one that was just discovered to
|
||||
be locked; don't include any other boxes which might be here */
|
||||
@@ -575,7 +575,7 @@ pick_lock(
|
||||
/* this is probably only relevant when blind */
|
||||
feel_location(cc.x, cc.y);
|
||||
if (door->glyph != oldglyph
|
||||
|| gl.lastseentyp[cc.x][cc.y] != oldlastseentyp)
|
||||
|| svl.lastseentyp[cc.x][cc.y] != oldlastseentyp)
|
||||
res = PICKLOCK_LEARNED_SOMETHING;
|
||||
|
||||
if (is_drawbridge_wall(cc.x, cc.y) >= 0)
|
||||
@@ -639,7 +639,7 @@ pick_lock(
|
||||
gx.xlock.box = 0;
|
||||
}
|
||||
}
|
||||
gc.context.move = 0;
|
||||
svc.context.move = 0;
|
||||
gx.xlock.chance = ch;
|
||||
gx.xlock.picktyp = picktyp;
|
||||
gx.xlock.magic_key = is_magic_key(&gy.youmonst, pick);
|
||||
@@ -706,7 +706,7 @@ doforce(void)
|
||||
|
||||
/* A lock is made only for the honest man, the thief will break it. */
|
||||
gx.xlock.box = (struct obj *) 0;
|
||||
for (otmp = gl.level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere)
|
||||
for (otmp = svl.level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere)
|
||||
if (Is_box(otmp)) {
|
||||
if (otmp->obroken || !otmp->olocked) {
|
||||
/* force doname() to omit known "broken" or "unlocked"
|
||||
@@ -827,7 +827,7 @@ doopen_indir(coordxy x, coordxy y)
|
||||
|
||||
newsym(cc.x, cc.y);
|
||||
if (door->glyph != oldglyph
|
||||
|| gl.lastseentyp[cc.x][cc.y] != oldlastseentyp)
|
||||
|| svl.lastseentyp[cc.x][cc.y] != oldlastseentyp)
|
||||
res = ECMD_TIME; /* learned something */
|
||||
}
|
||||
|
||||
@@ -989,7 +989,7 @@ doclose(void)
|
||||
schar oldlastseentyp = update_mapseen_for(x, y);
|
||||
|
||||
feel_location(x, y);
|
||||
if (door->glyph != oldglyph || gl.lastseentyp[x][y] != oldlastseentyp)
|
||||
if (door->glyph != oldglyph || svl.lastseentyp[x][y] != oldlastseentyp)
|
||||
res = ECMD_TIME; /* learned something */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user