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/invent.c
36
src/invent.c
@@ -355,7 +355,7 @@ loot_xname(struct obj *obj)
|
||||
if (wizard) { /* flags.debug */
|
||||
/* paranoia: before toggling off wizard mode, guard against a
|
||||
panic in xname() producing a normal mode panic save file */
|
||||
gp.program_state.something_worth_saving = 0;
|
||||
svp.program_state.something_worth_saving = 0;
|
||||
flags.debug = FALSE;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ loot_xname(struct obj *obj)
|
||||
|
||||
if (save_debug) {
|
||||
flags.debug = TRUE;
|
||||
gp.program_state.something_worth_saving = 1;
|
||||
svp.program_state.something_worth_saving = 1;
|
||||
}
|
||||
/* restore the object */
|
||||
if (obj->oclass == POTION_CLASS) {
|
||||
@@ -1006,11 +1006,11 @@ addinv_core1(struct obj *obj)
|
||||
dumplog, originally just recorded in XLOGFILE */
|
||||
if (is_mines_prize(obj)) {
|
||||
record_achievement(ACH_MINE_PRIZE);
|
||||
gc.context.achieveo.mines_prize_oid = 0; /* done with luckstone o_id */
|
||||
svc.context.achieveo.mines_prize_oid = 0; /* done with luckstone o_id */
|
||||
obj->nomerge = 0; /* was set in create_object(sp_lev.c) */
|
||||
} else if (is_soko_prize(obj)) {
|
||||
record_achievement(ACH_SOKO_PRIZE);
|
||||
gc.context.achieveo.soko_prize_oid = 0; /* done with bag/amulet o_id */
|
||||
svc.context.achieveo.soko_prize_oid = 0; /* done with bag/amulet o_id */
|
||||
obj->nomerge = 0; /* (got set in sp_lev.c) */
|
||||
}
|
||||
}
|
||||
@@ -1384,7 +1384,7 @@ delallobj(coordxy x, coordxy y)
|
||||
{
|
||||
struct obj *otmp, *otmp2;
|
||||
|
||||
for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp2) {
|
||||
for (otmp = svl.level.objects[x][y]; otmp; otmp = otmp2) {
|
||||
if (otmp == uball)
|
||||
unpunish();
|
||||
/* after unpunish(), or might get deallocated chain */
|
||||
@@ -1437,7 +1437,7 @@ sobj_at(int otyp, coordxy x, coordxy y)
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
|
||||
for (otmp = svl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
|
||||
if (otmp->otyp == otyp)
|
||||
break;
|
||||
|
||||
@@ -1561,7 +1561,7 @@ obj_here(struct obj *obj, coordxy x, coordxy y)
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
|
||||
for (otmp = svl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
|
||||
if (obj == otmp)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
@@ -1570,7 +1570,7 @@ obj_here(struct obj *obj, coordxy x, coordxy y)
|
||||
struct obj *
|
||||
g_at(coordxy x, coordxy y)
|
||||
{
|
||||
struct obj *obj = gl.level.objects[x][y];
|
||||
struct obj *obj = svl.level.objects[x][y];
|
||||
|
||||
while (obj) {
|
||||
if (obj->oclass == COIN_CLASS)
|
||||
@@ -2650,7 +2650,7 @@ update_inventory(void)
|
||||
{
|
||||
int save_suppress_price;
|
||||
|
||||
if (!gp.program_state.in_moveloop) /* not covered by suppress_map_output */
|
||||
if (!svp.program_state.in_moveloop) /* not covered by suppress_map_output */
|
||||
return;
|
||||
if (suppress_map_output()) /* despite name, used for perm_invent too */
|
||||
return;
|
||||
@@ -4347,7 +4347,7 @@ dotypeinv(void)
|
||||
title[0] = '\0';
|
||||
u_carried = count_unpaid(gi.invent);
|
||||
u_floor = count_unpaid(fobj);
|
||||
u_buried = count_unpaid(gl.level.buriedobjlist);
|
||||
u_buried = count_unpaid(svl.level.buriedobjlist);
|
||||
any_unpaid = u_carried + u_floor + u_buried;
|
||||
tally_BUCX(gi.invent, FALSE, &bcnt, &ucnt, &ccnt, &xcnt, &ocnt, &jcnt);
|
||||
|
||||
@@ -4661,7 +4661,7 @@ look_here(
|
||||
if (!skip_objects && (trap = t_at(u.ux, u.uy)) && trap->tseen)
|
||||
There("is %s here.", an(trapname(trap->ttyp, FALSE)));
|
||||
|
||||
otmp = gl.level.objects[u.ux][u.uy];
|
||||
otmp = svl.level.objects[u.ux][u.uy];
|
||||
dfeature = dfeature_at(u.ux, u.uy, fbuf2);
|
||||
if (dfeature && !strcmp(dfeature, "pool of water") && Underwater)
|
||||
dfeature = 0;
|
||||
@@ -4851,7 +4851,7 @@ stackobj(struct obj *obj)
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
for (otmp = gl.level.objects[obj->ox][obj->oy]; otmp; otmp = otmp->nexthere)
|
||||
for (otmp = svl.level.objects[obj->ox][obj->oy]; otmp; otmp = otmp->nexthere)
|
||||
if (otmp != obj && merged(&obj, &otmp))
|
||||
break;
|
||||
return;
|
||||
@@ -5249,7 +5249,7 @@ useupf(struct obj *obj, long numused)
|
||||
otmp = splitobj(obj, numused);
|
||||
else
|
||||
otmp = obj;
|
||||
if (!gc.context.mon_moving && costly_spot(otmp->ox, otmp->oy)) {
|
||||
if (!svc.context.mon_moving && costly_spot(otmp->ox, otmp->oy)) {
|
||||
if (strchr(u.urooms, *in_rooms(otmp->ox, otmp->oy, 0)))
|
||||
addtobill(otmp, FALSE, FALSE, FALSE);
|
||||
else
|
||||
@@ -5975,7 +5975,7 @@ display_binventory(coordxy x, coordxy y, boolean as_if_seen)
|
||||
should use the normal look_here command instead of probing (caller
|
||||
has already used bhitpile() which will have set dknown on all items) */
|
||||
if (is_pool_or_lava(x, y) && !Underwater
|
||||
&& (obj = gl.level.objects[x][y]) != 0) {
|
||||
&& (obj = svl.level.objects[x][y]) != 0) {
|
||||
const char *real_liquid = is_pool(x, y) ? "water" : "lava",
|
||||
*seen_liquid = hliquid(real_liquid);
|
||||
|
||||
@@ -5991,7 +5991,7 @@ display_binventory(coordxy x, coordxy y, boolean as_if_seen)
|
||||
underwhat = more_than_1 ? "under them" : "beneath it";
|
||||
} else {
|
||||
Sprintf(qbuf, "Things that are under the %s here:", seen_liquid);
|
||||
if (query_objlist(qbuf, &gl.level.objects[x][y], BY_NEXTHERE,
|
||||
if (query_objlist(qbuf, &svl.level.objects[x][y], BY_NEXTHERE,
|
||||
&selected, PICK_NONE, allow_all) > 0)
|
||||
free((genericptr_t) selected), selected = 0;
|
||||
for (n2 = 0; obj; obj = obj->nexthere)
|
||||
@@ -6001,7 +6001,7 @@ display_binventory(coordxy x, coordxy y, boolean as_if_seen)
|
||||
}
|
||||
|
||||
/* count # of buried objects here */
|
||||
for (n = 0, obj = gl.level.buriedobjlist; obj; obj = obj->nobj)
|
||||
for (n = 0, obj = svl.level.buriedobjlist; obj; obj = obj->nobj)
|
||||
if (obj->ox == x && obj->oy == y) {
|
||||
if (as_if_seen)
|
||||
obj->dknown = 1;
|
||||
@@ -6013,7 +6013,7 @@ display_binventory(coordxy x, coordxy y, boolean as_if_seen)
|
||||
go.only.y = y;
|
||||
/* "buried here", but vary if we've already shown underwater items */
|
||||
Sprintf(qbuf, "Things that are buried %s:", underwhat);
|
||||
if (query_objlist(qbuf, &gl.level.buriedobjlist, INVORDER_SORT,
|
||||
if (query_objlist(qbuf, &svl.level.buriedobjlist, INVORDER_SORT,
|
||||
&selected, PICK_NONE, only_here) > 0)
|
||||
free((genericptr_t) selected);
|
||||
go.only.x = go.only.y = 0;
|
||||
@@ -6120,7 +6120,7 @@ sync_perminvent(void)
|
||||
WIN_INVEN = create_nhwindow(NHW_MENU);
|
||||
}
|
||||
|
||||
if (WIN_INVEN != WIN_ERR && gp.program_state.beyond_savefile_load) {
|
||||
if (WIN_INVEN != WIN_ERR && svp.program_state.beyond_savefile_load) {
|
||||
gi.in_sync_perminvent = 1;
|
||||
(void) display_inventory((char *) 0, FALSE);
|
||||
gi.in_sync_perminvent = 0;
|
||||
|
||||
Reference in New Issue
Block a user