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:
@@ -704,17 +704,17 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
(*utf8graphics_mode_callback)();
|
||||
#endif
|
||||
|
||||
/* strip role,race,&c suffix; calls askname() if gp.plname[] is empty
|
||||
/* strip role,race,&c suffix; calls askname() if svp.plname[] is empty
|
||||
or holds a generic user name like "player" or "games" */
|
||||
plnamesuffix();
|
||||
set_playmode(); /* sets gp.plname to "wizard" for wizard mode */
|
||||
set_playmode(); /* sets svp.plname to "wizard" for wizard mode */
|
||||
/* until the getlock code is resolved, override askname()'s
|
||||
setting of renameallowed; when False, player_selection()
|
||||
won't resent renaming as an option */
|
||||
iflags.renameallowed = FALSE;
|
||||
/* Obtain the name of the logged on user and incorporate
|
||||
* it into the name. */
|
||||
Sprintf(fnamebuf, "%s", gp.plname);
|
||||
Sprintf(fnamebuf, "%s", svp.plname);
|
||||
(void) fname_encode(
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.", '%',
|
||||
fnamebuf, encodedfnamebuf, BUFSZ);
|
||||
@@ -732,8 +732,8 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
if (!nhfp) {
|
||||
raw_print("Cannot create lock file");
|
||||
} else {
|
||||
gh.hackpid = GetCurrentProcessId();
|
||||
(void) write(nhfp->fd, (genericptr_t) &gh.hackpid, sizeof(gh.hackpid));
|
||||
svh.hackpid = GetCurrentProcessId();
|
||||
(void) write(nhfp->fd, (genericptr_t) &svh.hackpid, sizeof(svh.hackpid));
|
||||
close_nhfile(nhfp);
|
||||
}
|
||||
/*
|
||||
@@ -771,8 +771,8 @@ attempt_restore:
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gp.program_state.in_self_recover) {
|
||||
gp.program_state.in_self_recover = FALSE;
|
||||
if (svp.program_state.in_self_recover) {
|
||||
svp.program_state.in_self_recover = FALSE;
|
||||
set_savefile_name(TRUE);
|
||||
}
|
||||
}
|
||||
@@ -923,11 +923,11 @@ process_options(int argc, char * argv[])
|
||||
#endif
|
||||
case 'u':
|
||||
if (argv[0][2])
|
||||
(void) strncpy(gp.plname, argv[0] + 2, sizeof(gp.plname) - 1);
|
||||
(void) strncpy(svp.plname, argv[0] + 2, sizeof(svp.plname) - 1);
|
||||
else if (argc > 1) {
|
||||
argc--;
|
||||
argv++;
|
||||
(void) strncpy(gp.plname, argv[0], sizeof(gp.plname) - 1);
|
||||
(void) strncpy(svp.plname, argv[0], sizeof(svp.plname) - 1);
|
||||
} else
|
||||
raw_print("Player name expected after -u");
|
||||
break;
|
||||
@@ -1052,7 +1052,7 @@ port_help(void)
|
||||
boolean
|
||||
authorize_wizard_mode(void)
|
||||
{
|
||||
if (!strcmp(gp.plname, WIZARD_NAME))
|
||||
if (!strcmp(svp.plname, WIZARD_NAME))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1417,8 +1417,8 @@ gotlock:
|
||||
gf.fqn_prefix[LEVELPREFIX]);
|
||||
raw_print(oops);
|
||||
} else {
|
||||
if (write(fd, (char *) &gh.hackpid, sizeof(gh.hackpid))
|
||||
!= sizeof(gh.hackpid)) {
|
||||
if (write(fd, (char *) &svh.hackpid, sizeof(svh.hackpid))
|
||||
!= sizeof(svh.hackpid)) {
|
||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||
chdirx(orgdir, 0);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user