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:
40
src/pickup.c
40
src/pickup.c
@@ -312,7 +312,7 @@ force_decor(boolean via_probing)
|
||||
iflags.prev_decor = STONE;
|
||||
(void) describe_decor();
|
||||
gd.decor_fumble_override = gd.decor_levitate_override = FALSE;
|
||||
gl.lastseentyp[u.ux][u.uy] = levl[u.ux][u.uy].typ;
|
||||
svl.lastseentyp[u.ux][u.uy] = levl[u.ux][u.uy].typ;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -421,14 +421,14 @@ check_here(boolean picked_some)
|
||||
}
|
||||
|
||||
/* count the objects here */
|
||||
for (obj = gl.level.objects[u.ux][u.uy]; obj; obj = obj->nexthere) {
|
||||
for (obj = svl.level.objects[u.ux][u.uy]; obj; obj = obj->nexthere) {
|
||||
if (obj != uchain)
|
||||
ct++;
|
||||
}
|
||||
|
||||
/* If there are objects here, take a look. */
|
||||
if (ct) {
|
||||
if (gc.context.run)
|
||||
if (svc.context.run)
|
||||
nomul(0);
|
||||
flush_screen(1);
|
||||
(void) look_here(ct, lhflags);
|
||||
@@ -681,7 +681,7 @@ pickup(int what) /* should be a long */
|
||||
struct trap *t;
|
||||
|
||||
/* no auto-pick if no-pick move, nothing there, or in a pool */
|
||||
if (autopickup && (gc.context.nopick || !OBJ_AT(u.ux, u.uy)
|
||||
if (autopickup && (svc.context.nopick || !OBJ_AT(u.ux, u.uy)
|
||||
|| (is_pool(u.ux, u.uy) && !Underwater)
|
||||
|| is_lava(u.ux, u.uy))) {
|
||||
if (flags.mention_decor)
|
||||
@@ -693,16 +693,16 @@ pickup(int what) /* should be a long */
|
||||
t = t_at(u.ux, u.uy);
|
||||
if (!can_reach_floor(t && is_pit(t->ttyp))) {
|
||||
(void) describe_decor(); /* even when !flags.mention_decor */
|
||||
if ((gm.multi && !gc.context.run) || (autopickup && !flags.pickup)
|
||||
if ((gm.multi && !svc.context.run) || (autopickup && !flags.pickup)
|
||||
|| (t && (uteetering_at_seen_pit(t) || uescaped_shaft(t))))
|
||||
read_engr_at(u.ux, u.uy);
|
||||
return 0;
|
||||
}
|
||||
/* multi && !gc.context.run means they are in the middle of some other
|
||||
/* multi && !svc.context.run means they are in the middle of some other
|
||||
* action, or possibly paralyzed, sleeping, etc.... and they just
|
||||
* teleported onto the object. They shouldn't pick it up.
|
||||
*/
|
||||
if ((gm.multi && !gc.context.run)
|
||||
if ((gm.multi && !svc.context.run)
|
||||
|| (autopickup && !flags.pickup)
|
||||
|| notake(gy.youmonst.data)) {
|
||||
check_here(FALSE);
|
||||
@@ -713,14 +713,14 @@ pickup(int what) /* should be a long */
|
||||
}
|
||||
|
||||
/* if there's anything here, stop running */
|
||||
if (OBJ_AT(u.ux, u.uy) && gc.context.run && gc.context.run != 8
|
||||
&& !gc.context.nopick)
|
||||
if (OBJ_AT(u.ux, u.uy) && svc.context.run && svc.context.run != 8
|
||||
&& !svc.context.nopick)
|
||||
nomul(0);
|
||||
}
|
||||
|
||||
add_valid_menu_class(0); /* reset */
|
||||
if (!u.uswallow) {
|
||||
objchain_p = &gl.level.objects[u.ux][u.uy];
|
||||
objchain_p = &svl.level.objects[u.ux][u.uy];
|
||||
traverse_how = BY_NEXTHERE;
|
||||
} else {
|
||||
objchain_p = &u.ustuck->minvent;
|
||||
@@ -2005,7 +2005,7 @@ container_at(coordxy x, coordxy y, boolean countem)
|
||||
struct obj *cobj, *nobj;
|
||||
int container_count = 0;
|
||||
|
||||
for (cobj = gl.level.objects[x][y]; cobj; cobj = nobj) {
|
||||
for (cobj = svl.level.objects[x][y]; cobj; cobj = nobj) {
|
||||
nobj = cobj->nexthere;
|
||||
if (Is_container(cobj)) {
|
||||
container_count++;
|
||||
@@ -2077,7 +2077,7 @@ do_loot_cont(
|
||||
int res = ECMD_OK;
|
||||
|
||||
#if 0
|
||||
if (ccount < 2 && (gl.level.objects[cobj->ox][cobj->oy] == cobj))
|
||||
if (ccount < 2 && (svl.level.objects[cobj->ox][cobj->oy] == cobj))
|
||||
pline("%s locked.",
|
||||
cobj->lknown ? "It is" : "Hmmm, it turns out to be");
|
||||
else
|
||||
@@ -2105,7 +2105,7 @@ do_loot_cont(
|
||||
res = ECMD_TIME;
|
||||
/* attempting to untrap or unlock might trigger a trap
|
||||
which destroys 'cobj'; inform caller if that happens */
|
||||
for (otmp = gl.level.objects[ox][oy]; otmp;
|
||||
for (otmp = svl.level.objects[ox][oy]; otmp;
|
||||
otmp = otmp->nexthere)
|
||||
if (otmp == cobj)
|
||||
break;
|
||||
@@ -2223,7 +2223,7 @@ doloot_core(void)
|
||||
win = create_nhwindow(NHW_MENU);
|
||||
start_menu(win, MENU_BEHAVE_STANDARD);
|
||||
|
||||
for (cobj = gl.level.objects[cc.x][cc.y]; cobj;
|
||||
for (cobj = svl.level.objects[cc.x][cc.y]; cobj;
|
||||
cobj = cobj->nexthere)
|
||||
if (Is_container(cobj)) {
|
||||
any.a_obj = cobj;
|
||||
@@ -2249,7 +2249,7 @@ doloot_core(void)
|
||||
if (n != 0)
|
||||
c = 'y';
|
||||
} else {
|
||||
for (cobj = gl.level.objects[cc.x][cc.y]; cobj; cobj = nobj) {
|
||||
for (cobj = svl.level.objects[cc.x][cc.y]; cobj; cobj = nobj) {
|
||||
nobj = cobj->nexthere;
|
||||
|
||||
if (Is_container(cobj)) {
|
||||
@@ -2619,7 +2619,7 @@ in_container(struct obj *obj)
|
||||
}
|
||||
}
|
||||
if (Icebox && !age_is_relative(obj)) {
|
||||
obj->age = gm.moves - obj->age; /* actual age */
|
||||
obj->age = svm.moves - obj->age; /* actual age */
|
||||
/* stop any corpse timeouts when frozen */
|
||||
if (obj->otyp == CORPSE) {
|
||||
if (obj->timed) {
|
||||
@@ -2758,7 +2758,7 @@ void
|
||||
removed_from_icebox(struct obj *obj)
|
||||
{
|
||||
if (!age_is_relative(obj)) {
|
||||
obj->age = gm.moves - obj->age; /* actual age */
|
||||
obj->age = svm.moves - obj->age; /* actual age */
|
||||
if (obj->otyp == CORPSE) {
|
||||
struct monst *m = get_mtraits(obj, FALSE);
|
||||
boolean iceT = m ? (m->data == &mons[PM_ICE_TROLL])
|
||||
@@ -2847,7 +2847,7 @@ observe_quantum_cat(struct obj *box, boolean makecat, boolean givemsg)
|
||||
/* set_corpsenm() will start the rot timer that was removed
|
||||
when makemon() created SchroedingersBox; start it from
|
||||
now rather than from when this special corpse got created */
|
||||
deadcat->age = gm.moves;
|
||||
deadcat->age = svm.moves;
|
||||
set_corpsenm(deadcat, PM_HOUSECAT);
|
||||
deadcat = oname(deadcat, sc, ONAME_NO_FLAGS);
|
||||
}
|
||||
@@ -3476,7 +3476,7 @@ choose_tip_container_menu(void)
|
||||
win = create_nhwindow(NHW_MENU);
|
||||
start_menu(win, MENU_BEHAVE_STANDARD);
|
||||
|
||||
for (otmp = gl.level.objects[u.ux][u.uy], i = 0; otmp;
|
||||
for (otmp = svl.level.objects[u.ux][u.uy], i = 0; otmp;
|
||||
otmp = otmp->nexthere)
|
||||
if (Is_container(otmp)) {
|
||||
++i;
|
||||
@@ -3560,7 +3560,7 @@ dotip(void)
|
||||
return res;
|
||||
/* else pick-from-gi.invent below */
|
||||
} else {
|
||||
for (cobj = gl.level.objects[cc.x][cc.y]; cobj; cobj = nobj) {
|
||||
for (cobj = svl.level.objects[cc.x][cc.y]; cobj; cobj = nobj) {
|
||||
nobj = cobj->nexthere;
|
||||
if (!Is_container(cobj))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user