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:
197
include/decl.h
197
include/decl.h
@@ -194,13 +194,9 @@ struct instance_globals_b {
|
||||
#endif
|
||||
|
||||
/* decl.c */
|
||||
int bases[MAXOCLASSES + 2]; /* make bases[MAXOCLASSES+1] available */
|
||||
coord bhitpos; /* place where throw or zap hits or stops */
|
||||
struct obj *billobjs; /* objects not yet paid for */
|
||||
|
||||
/* dungeon.c */
|
||||
branch *branches; /* dungeon branch list */
|
||||
|
||||
/* files.c */
|
||||
char bones[BONESSIZE];
|
||||
|
||||
@@ -212,7 +208,6 @@ struct instance_globals_b {
|
||||
/* mkmaze.c */
|
||||
lev_region bughack; /* for preserving the insect legs when wallifying
|
||||
* baalz level */
|
||||
struct bubble *bbubbles;
|
||||
|
||||
/* pickup.c */
|
||||
boolean bucx_filter;
|
||||
@@ -253,7 +248,6 @@ struct instance_globals_c {
|
||||
#ifdef DEF_PAGER
|
||||
const char *catmore; /* external pager; from getenv() or DEF_PAGER */
|
||||
#endif
|
||||
struct context_info context;
|
||||
|
||||
/* dog.c */
|
||||
char catname[PL_PSIZ];
|
||||
@@ -317,12 +311,7 @@ struct instance_globals_d {
|
||||
long domove_succeeded;
|
||||
#define DOMOVE_WALK 0x00000001
|
||||
#define DOMOVE_RUSH 0x00000002
|
||||
dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */
|
||||
dest_area dndest;
|
||||
boolean defer_see_monsters;
|
||||
struct dgn_topology dungeon_topology;
|
||||
int doors_alloc; /* doors-array allocated size */
|
||||
coord *doors; /* array of door locations */
|
||||
|
||||
/* dig.c */
|
||||
boolean did_dig_msg;
|
||||
@@ -341,9 +330,6 @@ struct instance_globals_d {
|
||||
/* mon.c */
|
||||
boolean disintegested;
|
||||
|
||||
/* o_init.c */
|
||||
short disco[NUM_OBJECTS];
|
||||
|
||||
/* objname.c */
|
||||
/* distantname used by distant_name() to pass extra information to
|
||||
xname_flags(); it would be much cleaner if this were a parameter,
|
||||
@@ -372,7 +358,6 @@ struct instance_globals_e {
|
||||
struct bubble *ebubbles;
|
||||
|
||||
/* new stuff */
|
||||
struct exclusion_zone *exclusion_zones;
|
||||
int early_raw_messages; /* if raw_prints occurred early prior
|
||||
to gb.beyond_savefile_load */
|
||||
|
||||
@@ -457,7 +442,6 @@ struct instance_globals_h {
|
||||
|
||||
/* decl.c */
|
||||
const char *hname; /* name of the game (argv[0] of main) */
|
||||
int hackpid; /* current process id */
|
||||
#if defined(MICRO) || defined(WIN32)
|
||||
char hackdir[PATHLEN]; /* where rumors, help, record are */
|
||||
#endif /* MICRO || WIN32 */
|
||||
@@ -479,7 +463,6 @@ struct instance_globals_i {
|
||||
|
||||
/* decl.c */
|
||||
int in_doagain;
|
||||
coord inv_pos;
|
||||
boolean in_mklev;
|
||||
boolean in_steed_dismounting;
|
||||
struct obj *invent;
|
||||
@@ -525,7 +508,6 @@ struct instance_globals_k {
|
||||
|
||||
/* decl.c */
|
||||
struct obj *kickedobj; /* object in flight due to kicking */
|
||||
struct kinfo killer;
|
||||
|
||||
/* read.c */
|
||||
boolean known;
|
||||
@@ -540,9 +522,6 @@ struct instance_globals_l {
|
||||
cmdcount_nht last_command_count;
|
||||
|
||||
/* decl.c (before being incorporated into instance_globals_*) */
|
||||
schar lastseentyp[COLNO][ROWNO]; /* last seen/touched dungeon typ */
|
||||
struct linfo level_info[MAXLINFO];
|
||||
dlevel_t level; /* level map */
|
||||
#if defined(UNIX) || defined(VMS)
|
||||
int locknum; /* max num of simultaneous users */
|
||||
#endif
|
||||
@@ -620,20 +599,15 @@ struct instance_globals_m {
|
||||
struct multishot m_shot;
|
||||
boolean mrg_to_wielded; /* weapon picked is merged with wielded one */
|
||||
struct menucoloring *menu_colorings;
|
||||
long moves; /* turn counter */
|
||||
struct obj *migrating_objs; /* objects moving to another dungeon level */
|
||||
|
||||
/* dog.c */
|
||||
struct monst *mydogs; /* monsters that went down/up together with @ */
|
||||
struct monst *migrating_mons; /* monsters moving to another level */
|
||||
struct mvitals mvitals[NUMMONS];
|
||||
|
||||
/* dokick.c */
|
||||
struct rm *maploc;
|
||||
|
||||
/* dungeon.c */
|
||||
mapseen *mapseenchn; /*DUNGEON_OVERVIEW*/
|
||||
|
||||
/* mhitu.c */
|
||||
int mhitu_dieroll;
|
||||
|
||||
@@ -682,15 +656,11 @@ struct instance_globals_n {
|
||||
|
||||
/* decl.c */
|
||||
const char *nomovemsg;
|
||||
int nroom;
|
||||
int nsubroom;
|
||||
|
||||
/* dokick.c */
|
||||
struct rm nowhere;
|
||||
|
||||
/* dungeon.c */
|
||||
int n_dgns; /* number of dungeons (also used in mklev.c and do.c) */
|
||||
|
||||
/* files.c */
|
||||
int nesting;
|
||||
int no_sound_notified; /* run-time option processing: warn once if built
|
||||
@@ -713,9 +683,6 @@ struct instance_globals_n {
|
||||
/* questpgr.c */
|
||||
char nambuf[CVT_BUF_SIZE];
|
||||
|
||||
/* region.c */
|
||||
int n_regions;
|
||||
|
||||
/* restore.c */
|
||||
int n_ids_mapped;
|
||||
|
||||
@@ -779,7 +746,6 @@ struct instance_globals_o {
|
||||
|
||||
/* rumors.c */
|
||||
int oracle_flg; /* -1=>don't use, 0=>need init, 1=>init done */
|
||||
unsigned oracle_cnt; /* oracles are handled differently from rumors... */
|
||||
unsigned long *oracle_loc;
|
||||
|
||||
/* uhitm.c */
|
||||
@@ -799,13 +765,9 @@ struct instance_globals_p {
|
||||
int polearm_range_max;
|
||||
|
||||
/* decl.c */
|
||||
char plname[PL_NSIZ]; /* player name */
|
||||
int plnamelen; /* length of plname[] if that came from getlogin() */
|
||||
char pl_character[PL_CSIZ];
|
||||
char pl_race; /* character's race */
|
||||
char pl_fruit[PL_FSIZ];
|
||||
struct plinemsg_type *plinemsg_types;
|
||||
struct sinfo program_state; /* flags describing game's current state */
|
||||
|
||||
/* dog.c */
|
||||
int petname_used; /* user preferred pet name has been used */
|
||||
@@ -849,18 +811,12 @@ struct instance_globals_p {
|
||||
|
||||
struct instance_globals_q {
|
||||
|
||||
/* quest.c */
|
||||
struct q_score quest_status;
|
||||
|
||||
boolean havestate;
|
||||
unsigned long magic; /* validate that structure layout is preserved */
|
||||
};
|
||||
|
||||
struct instance_globals_r {
|
||||
|
||||
/* decl.c */
|
||||
struct mkroom rooms[(MAXNROFROOMS + 1) * 2];
|
||||
|
||||
/* symbols.c */
|
||||
nhsym rogue_syms[SYM_MAX]; /* loaded rogue symbols */
|
||||
|
||||
@@ -895,11 +851,9 @@ struct instance_globals_s {
|
||||
messages in artifact_hit() */
|
||||
|
||||
/* decl.c */
|
||||
s_level * sp_levchn;
|
||||
stairway *stairs;
|
||||
int smeq[MAXNROFROOMS + 1];
|
||||
boolean stoned; /* done to monsters hit by 'c' */
|
||||
struct spell spl_book[MAXSPELL + 1];
|
||||
struct mkroom *subrooms;
|
||||
|
||||
/* do.c */
|
||||
@@ -958,7 +912,7 @@ struct instance_globals_s {
|
||||
|
||||
/* spells.c */
|
||||
int spl_sortmode; /* index into spl_sortchoices[] */
|
||||
int *spl_orderindx; /* array of gs.spl_book[] indices */
|
||||
int *spl_orderindx; /* array of svs.spl_book[] indices */
|
||||
|
||||
/* steal.c */
|
||||
unsigned int stealoid; /* object to be stolen */
|
||||
@@ -977,7 +931,6 @@ struct instance_globals_t {
|
||||
struct trapinfo trapinfo;
|
||||
|
||||
/* decl.c */
|
||||
char tune[6];
|
||||
schar tbx; /* mthrowu: target x */
|
||||
schar tby; /* mthrowu: target y */
|
||||
char toplines[TBUFSZ];
|
||||
@@ -1012,7 +965,6 @@ struct instance_globals_t {
|
||||
/* timeout.c */
|
||||
/* ordered timer list */
|
||||
struct fe *timer_base; /* "active" */
|
||||
unsigned long timer_id;
|
||||
|
||||
/* topten.c */
|
||||
winid toptenwin;
|
||||
@@ -1030,7 +982,6 @@ struct instance_globals_u {
|
||||
boolean update_all;
|
||||
|
||||
/* decl.c */
|
||||
dest_area updest;
|
||||
boolean unweapon;
|
||||
|
||||
/* role.c */
|
||||
@@ -1115,9 +1066,6 @@ struct instance_globals_x {
|
||||
/* lock.c */
|
||||
struct xlock_s xlock;
|
||||
|
||||
/* mkmaze.c */
|
||||
int xmin, xmax; /* level boundaries x */
|
||||
|
||||
/* objnam.c */
|
||||
char *xnamep; /* obuf[] returned by xname(), for use in doname() for
|
||||
* bounds checking; differs from xname() return value
|
||||
@@ -1137,9 +1085,6 @@ struct instance_globals_y {
|
||||
int y_maze_max;
|
||||
struct monst youmonst;
|
||||
|
||||
/* mkmaze.c */
|
||||
int ymin, ymax; /* level boundaries y */
|
||||
|
||||
/* pline.c */
|
||||
/* work buffer for You(), &c and verbalize() */
|
||||
char *you_buf;
|
||||
@@ -1169,6 +1114,127 @@ struct instance_globals_z {
|
||||
unsigned long magic; /* validate that structure layout is preserved */
|
||||
};
|
||||
|
||||
struct instance_globals_saved_b {
|
||||
/* dungeon.c */
|
||||
branch *branches; /* dungeon branch list */
|
||||
/* mkmaze.c */
|
||||
struct bubble *bbubbles;
|
||||
/* o_init.c */
|
||||
int bases[MAXOCLASSES + 2]; /* make bases[MAXOCLASSES+1] available */
|
||||
};
|
||||
|
||||
struct instance_globals_saved_c {
|
||||
/* decl.c */
|
||||
struct context_info context;
|
||||
};
|
||||
|
||||
struct instance_globals_saved_d {
|
||||
/* dungeon.c */
|
||||
dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */
|
||||
struct dgn_topology dungeon_topology;
|
||||
/* decl.c */
|
||||
dest_area dndest;
|
||||
coord *doors; /* array of door locations */
|
||||
int doors_alloc; /* doors-array allocated size */
|
||||
/* o_init.c */
|
||||
short disco[NUM_OBJECTS];
|
||||
};
|
||||
|
||||
struct instance_globals_saved_e {
|
||||
/* decl.c */
|
||||
struct exclusion_zone *exclusion_zones;
|
||||
};
|
||||
|
||||
struct instance_globals_saved_h {
|
||||
/* decl.c */
|
||||
int hackpid; /* current process id */
|
||||
};
|
||||
|
||||
struct instance_globals_saved_i {
|
||||
/* decl.c */
|
||||
coord inv_pos;
|
||||
};
|
||||
|
||||
struct instance_globals_saved_k {
|
||||
/* decl.c */
|
||||
struct kinfo killer;
|
||||
};
|
||||
|
||||
struct instance_globals_saved_l {
|
||||
/* decl.c */
|
||||
schar lastseentyp[COLNO][ROWNO]; /* last seen/touched dungeon typ */
|
||||
dlevel_t level; /* level map */
|
||||
struct linfo level_info[MAXLINFO];
|
||||
};
|
||||
|
||||
struct instance_globals_saved_m {
|
||||
/* dungeon.c */
|
||||
mapseen *mapseenchn; /*DUNGEON_OVERVIEW*/
|
||||
/* decl.c */
|
||||
long moves; /* turn counter */
|
||||
struct mvitals mvitals[NUMMONS];
|
||||
};
|
||||
|
||||
struct instance_globals_saved_n {
|
||||
/* dungeon.c */
|
||||
int n_dgns; /* number of dungeons (also used in mklev.c and do.c) */
|
||||
/* mkroom.c */
|
||||
int nroom;
|
||||
/* region.c */
|
||||
int n_regions;
|
||||
};
|
||||
|
||||
struct instance_globals_saved_o {
|
||||
/* rumors.c */
|
||||
unsigned oracle_cnt; /* oracles are handled differently from rumors... */
|
||||
};
|
||||
|
||||
struct instance_globals_saved_p {
|
||||
/* decl.c */
|
||||
char plname[PL_NSIZ]; /* player name */
|
||||
char pl_character[PL_CSIZ];
|
||||
char pl_fruit[PL_FSIZ];
|
||||
struct sinfo program_state; /* flags describing game's current state */
|
||||
};
|
||||
|
||||
struct instance_globals_saved_q {
|
||||
/* quest.c */
|
||||
struct q_score quest_status;
|
||||
};
|
||||
|
||||
struct instance_globals_saved_r {
|
||||
/* mkroom.c */
|
||||
struct mkroom rooms[(MAXNROFROOMS + 1) * 2];
|
||||
};
|
||||
|
||||
struct instance_globals_saved_s {
|
||||
/* decl.c */
|
||||
struct spell spl_book[MAXSPELL + 1];
|
||||
s_level *sp_levchn;
|
||||
};
|
||||
|
||||
struct instance_globals_saved_t {
|
||||
/* decl.c */
|
||||
char tune[6];
|
||||
/* timeout.c */
|
||||
unsigned long timer_id;
|
||||
};
|
||||
|
||||
struct instance_globals_saved_u {
|
||||
/* decl.c */
|
||||
dest_area updest;
|
||||
};
|
||||
|
||||
struct instance_globals_saved_x {
|
||||
/* mkmaze.c */
|
||||
int xmin, xmax; /* level boundaries x */
|
||||
};
|
||||
|
||||
struct instance_globals_saved_y {
|
||||
/* mkmaze.c */
|
||||
int ymin, ymax; /* level boundaries y */
|
||||
};
|
||||
|
||||
extern struct instance_globals_a ga;
|
||||
extern struct instance_globals_b gb;
|
||||
extern struct instance_globals_c gc;
|
||||
@@ -1195,6 +1261,25 @@ extern struct instance_globals_w gw;
|
||||
extern struct instance_globals_x gx;
|
||||
extern struct instance_globals_y gy;
|
||||
extern struct instance_globals_z gz;
|
||||
extern struct instance_globals_saved_b svb;
|
||||
extern struct instance_globals_saved_c svc;
|
||||
extern struct instance_globals_saved_d svd;
|
||||
extern struct instance_globals_saved_e sve;
|
||||
extern struct instance_globals_saved_h svh;
|
||||
extern struct instance_globals_saved_i svi;
|
||||
extern struct instance_globals_saved_k svk;
|
||||
extern struct instance_globals_saved_l svl;
|
||||
extern struct instance_globals_saved_m svm;
|
||||
extern struct instance_globals_saved_n svn;
|
||||
extern struct instance_globals_saved_o svo;
|
||||
extern struct instance_globals_saved_p svp;
|
||||
extern struct instance_globals_saved_q svq;
|
||||
extern struct instance_globals_saved_r svr;
|
||||
extern struct instance_globals_saved_s svs;
|
||||
extern struct instance_globals_saved_t svt;
|
||||
extern struct instance_globals_saved_u svu;
|
||||
extern struct instance_globals_saved_x svx;
|
||||
extern struct instance_globals_saved_y svy;
|
||||
|
||||
struct const_globals {
|
||||
const struct obj zeroobj; /* used to zero out a struct obj */
|
||||
|
||||
Reference in New Issue
Block a user