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:
30
src/vault.c
30
src/vault.c
@@ -49,7 +49,7 @@ clear_fcorr(struct monst *grd, boolean forceshow)
|
||||
coordxy fcx, fcy, fcbeg;
|
||||
struct monst *mtmp;
|
||||
boolean sawcorridor = FALSE,
|
||||
silently = gp.program_state.stopprint ? TRUE : FALSE;
|
||||
silently = svp.program_state.stopprint ? TRUE : FALSE;
|
||||
struct egd *egrd = EGD(grd);
|
||||
struct trap *trap;
|
||||
struct rm *lev;
|
||||
@@ -156,8 +156,8 @@ parkguard(struct monst *grd)
|
||||
{
|
||||
/* either guard is dead or will now be treated as if so;
|
||||
monster traversal loops should skip it */
|
||||
if (grd == gc.context.polearm.hitmon)
|
||||
gc.context.polearm.hitmon = 0;
|
||||
if (grd == svc.context.polearm.hitmon)
|
||||
svc.context.polearm.hitmon = 0;
|
||||
if (grd->mx) {
|
||||
remove_monster(grd->mx, grd->my);
|
||||
newsym(grd->mx, grd->my);
|
||||
@@ -246,7 +246,7 @@ vault_occupied(char *array)
|
||||
char *ptr;
|
||||
|
||||
for (ptr = array; *ptr; ptr++)
|
||||
if (gr.rooms[*ptr - ROOMOFFSET].rtype == VAULT)
|
||||
if (svr.rooms[*ptr - ROOMOFFSET].rtype == VAULT)
|
||||
return *ptr;
|
||||
return '\0';
|
||||
}
|
||||
@@ -495,13 +495,13 @@ invault(void)
|
||||
|
||||
if (u.ualign.type == A_LAWFUL
|
||||
/* ignore trailing text, in case player includes rank */
|
||||
&& strncmpi(buf, gp.plname, (int) strlen(gp.plname)) != 0) {
|
||||
&& strncmpi(buf, svp.plname, (int) strlen(svp.plname)) != 0) {
|
||||
adjalign(-1); /* Liar! */
|
||||
}
|
||||
|
||||
if (!strcmpi(buf, "Croesus") || !strcmpi(buf, "Kroisos")
|
||||
|| !strcmpi(buf, "Creosote")) { /* Discworld */
|
||||
if (!gm.mvitals[PM_CROESUS].died) {
|
||||
if (!svm.mvitals[PM_CROESUS].died) {
|
||||
if (Deaf) {
|
||||
if (!Blind)
|
||||
pline("%s waves goodbye.", noit_Monnam(guard));
|
||||
@@ -583,8 +583,8 @@ invault(void)
|
||||
dug into an empty doorway (which could subsequently have
|
||||
been plugged with an intact door by use of locking magic) */
|
||||
int vlt = EGD(guard)->vroom;
|
||||
coordxy lowx = gr.rooms[vlt].lx, hix = gr.rooms[vlt].hx;
|
||||
coordxy lowy = gr.rooms[vlt].ly, hiy = gr.rooms[vlt].hy;
|
||||
coordxy lowx = svr.rooms[vlt].lx, hix = svr.rooms[vlt].hx;
|
||||
coordxy lowy = svr.rooms[vlt].ly, hiy = svr.rooms[vlt].hy;
|
||||
|
||||
if (x == lowx - 1 && y == lowy - 1)
|
||||
typ = TLCORNER;
|
||||
@@ -623,8 +623,8 @@ move_gold(struct obj *gold, int vroom)
|
||||
|
||||
remove_object(gold);
|
||||
newsym(gold->ox, gold->oy);
|
||||
nx = gr.rooms[vroom].lx + rn2(2);
|
||||
ny = gr.rooms[vroom].ly + rn2(2);
|
||||
nx = svr.rooms[vroom].lx + rn2(2);
|
||||
ny = svr.rooms[vroom].ly + rn2(2);
|
||||
place_object(gold, nx, ny);
|
||||
stackobj(gold);
|
||||
newsym(nx, ny);
|
||||
@@ -637,8 +637,8 @@ wallify_vault(struct monst *grd)
|
||||
coordxy x, y;
|
||||
int vlt = EGD(grd)->vroom;
|
||||
char tmp_viz;
|
||||
coordxy lox = gr.rooms[vlt].lx - 1, hix = gr.rooms[vlt].hx + 1,
|
||||
loy = gr.rooms[vlt].ly - 1, hiy = gr.rooms[vlt].hy + 1;
|
||||
coordxy lox = svr.rooms[vlt].lx - 1, hix = svr.rooms[vlt].hx + 1,
|
||||
loy = svr.rooms[vlt].ly - 1, hiy = svr.rooms[vlt].hy + 1;
|
||||
struct monst *mon;
|
||||
struct obj *gold, *rocks;
|
||||
struct trap *trap;
|
||||
@@ -1210,10 +1210,10 @@ paygd(boolean silently)
|
||||
mnexto(grd, RLOC_NOMSG);
|
||||
if (!silently)
|
||||
pline("%s remits your gold to the vault.", Monnam(grd));
|
||||
gdx = gr.rooms[EGD(grd)->vroom].lx + rn2(2);
|
||||
gdy = gr.rooms[EGD(grd)->vroom].ly + rn2(2);
|
||||
gdx = svr.rooms[EGD(grd)->vroom].lx + rn2(2);
|
||||
gdy = svr.rooms[EGD(grd)->vroom].ly + rn2(2);
|
||||
Sprintf(buf, "To Croesus: here's the gold recovered from %s the %s.",
|
||||
gp.plname,
|
||||
svp.plname,
|
||||
pmname(&mons[u.umonster], flags.female ? FEMALE : MALE));
|
||||
make_grave(gdx, gdy, buf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user