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/botl.c
30
src/botl.c
@@ -58,7 +58,7 @@ do_statusline1(void)
|
||||
if (suppress_map_output())
|
||||
return strcpy(newbot1, "");
|
||||
|
||||
Strcpy(newbot1, gp.plname);
|
||||
Strcpy(newbot1, svp.plname);
|
||||
if ('a' <= newbot1[0] && newbot1[0] <= 'z')
|
||||
newbot1[0] += 'A' - 'a';
|
||||
newbot1[10] = 0;
|
||||
@@ -160,7 +160,7 @@ do_statusline2(void)
|
||||
|
||||
/* time/move counter */
|
||||
if (flags.time)
|
||||
Sprintf(tmmv, "T:%ld", gm.moves);
|
||||
Sprintf(tmmv, "T:%ld", svm.moves);
|
||||
else
|
||||
tmmv[0] = '\0';
|
||||
tln = strlen(tmmv);
|
||||
@@ -281,7 +281,7 @@ timebot(void)
|
||||
if (gb.bot_disabled)
|
||||
return;
|
||||
/* we're called when disp.time_botl is set and general disp.botl
|
||||
is clear; disp.time_botl gets set whenever gm.moves changes value
|
||||
is clear; disp.time_botl gets set whenever svm.moves changes value
|
||||
so there's no benefit in tracking previous value to decide whether
|
||||
to skip update; suppress_map_output() handles program_state.restoring
|
||||
and program_state.done_hup (tty hangup => no further output at all)
|
||||
@@ -451,7 +451,7 @@ describe_level(
|
||||
int ret = 1;
|
||||
|
||||
if (Is_knox(&u.uz)) {
|
||||
Sprintf(buf, "%s", gd.dungeons[u.uz.dnum].dname);
|
||||
Sprintf(buf, "%s", svd.dungeons[u.uz.dnum].dname);
|
||||
addbranch = FALSE;
|
||||
} else if (In_quest(&u.uz)) {
|
||||
Sprintf(buf, "Home %d", dunlev(&u.uz));
|
||||
@@ -471,7 +471,7 @@ describe_level(
|
||||
ret = 0;
|
||||
}
|
||||
if (addbranch) {
|
||||
Sprintf(eos(buf), ", %s", gd.dungeons[u.uz.dnum].dname);
|
||||
Sprintf(eos(buf), ", %s", svd.dungeons[u.uz.dnum].dname);
|
||||
(void) strsubst(buf, "The ", "the ");
|
||||
}
|
||||
if (addspace)
|
||||
@@ -769,7 +769,7 @@ bot_via_windowport(void)
|
||||
/*
|
||||
* Player name and title.
|
||||
*/
|
||||
Strcpy(nb = buf, gp.plname);
|
||||
Strcpy(nb = buf, svp.plname);
|
||||
nb[0] = highc(nb[0]);
|
||||
titl = !Upolyd ? rank() : pmname(&mons[u.umonnum], Ugender);
|
||||
i = (int) (strlen(buf) + sizeof " the " + strlen(titl) - sizeof "");
|
||||
@@ -873,7 +873,7 @@ bot_via_windowport(void)
|
||||
gb.blstats[idx][BL_EXP].a.a_long = u.uexp;
|
||||
|
||||
/* Time (moves) */
|
||||
gb.blstats[idx][BL_TIME].a.a_long = gm.moves;
|
||||
gb.blstats[idx][BL_TIME].a.a_long = svm.moves;
|
||||
|
||||
/* Hunger */
|
||||
/* note: u.uhs is unsigned, and 3.6.1's STATUS_HILITE defined
|
||||
@@ -1042,7 +1042,7 @@ stat_update_time(void)
|
||||
int fld = BL_TIME;
|
||||
|
||||
/* Time (moves) */
|
||||
gb.blstats[idx][fld].a.a_long = gm.moves;
|
||||
gb.blstats[idx][fld].a.a_long = svm.moves;
|
||||
gv.valset[fld] = FALSE;
|
||||
|
||||
eval_notify_windowport_field(fld, gv.valset, idx);
|
||||
@@ -1298,17 +1298,17 @@ eval_notify_windowport_field(
|
||||
}
|
||||
|
||||
/* Temporary? hack: moveloop()'s prolog for a new game sets
|
||||
* gc.context.rndencode after the status window has been init'd,
|
||||
* svc.context.rndencode after the status window has been init'd,
|
||||
* so $:0 has already been encoded and cached by the window
|
||||
* port. Without this hack, gold's \G sequence won't be
|
||||
* recognized and ends up being displayed as-is for 'gu.update_all'.
|
||||
*
|
||||
* Also, even if gc.context.rndencode hasn't changed and the
|
||||
* Also, even if svc.context.rndencode hasn't changed and the
|
||||
* gold amount itself hasn't changed, the glyph portion of the
|
||||
* encoding may have changed if a new symset was put into effect.
|
||||
*
|
||||
* \GXXXXNNNN:25
|
||||
* XXXX = the gc.context.rndencode portion
|
||||
* XXXX = the svc.context.rndencode portion
|
||||
* NNNN = the glyph portion
|
||||
* 25 = the gold amount
|
||||
*
|
||||
@@ -1316,10 +1316,10 @@ eval_notify_windowport_field(
|
||||
* not to honor an initial highlight, so force 'gu.update_all = TRUE'.
|
||||
*/
|
||||
if (fld == BL_GOLD
|
||||
&& (gc.context.rndencode != oldrndencode
|
||||
&& (svc.context.rndencode != oldrndencode
|
||||
|| gs.showsyms[COIN_CLASS + SYM_OFF_O] != oldgoldsym)) {
|
||||
gu.update_all = TRUE; /* chg = 2; */
|
||||
oldrndencode = gc.context.rndencode;
|
||||
oldrndencode = svc.context.rndencode;
|
||||
oldgoldsym = gs.showsyms[COIN_CLASS + SYM_OFF_O];
|
||||
}
|
||||
|
||||
@@ -2023,7 +2023,7 @@ status_eval_next_unhilite(void)
|
||||
struct istat_s *curr;
|
||||
long next_unhilite, this_unhilite;
|
||||
|
||||
gb.bl_hilite_moves = gm.moves; /* simplified; at one point we used to
|
||||
gb.bl_hilite_moves = svm.moves; /* simplified; at one point we used to
|
||||
* try to encode fractional amounts for
|
||||
* multiple moves within same turn */
|
||||
/* figure out whether an unhilight needs to be performed now */
|
||||
@@ -2276,7 +2276,7 @@ get_hilite(
|
||||
txtstr = gb.blstats[idx][fldidx].val;
|
||||
if (fldidx == BL_TITLE)
|
||||
/* "<name> the <rank-title>", skip past "<name> the " */
|
||||
txtstr += (strlen(gp.plname) + sizeof " the " - sizeof "");
|
||||
txtstr += (strlen(svp.plname) + sizeof " the " - sizeof "");
|
||||
if (hl->rel == TXT_VALUE && hl->textmatch[0]) {
|
||||
if (fuzzymatch(hl->textmatch, txtstr, "\" -_", TRUE)) {
|
||||
rule = hl;
|
||||
|
||||
Reference in New Issue
Block a user