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:
@@ -81,7 +81,7 @@ nhmain(int argc, char *argv[])
|
||||
early_init(argc, argv);
|
||||
|
||||
gh.hname = argv[0];
|
||||
gh.hackpid = getpid();
|
||||
svh.hackpid = getpid();
|
||||
(void) umask(0777 & ~FCMASK);
|
||||
|
||||
choose_windows(DEFAULT_WINDOW_SYS);
|
||||
@@ -193,7 +193,7 @@ nhmain(int argc, char *argv[])
|
||||
* It seems you really want to play.
|
||||
*/
|
||||
u.uhp = 1; /* prevent RIP on early quits */
|
||||
gp.program_state.preserve_locks = 1;
|
||||
svp.program_state.preserve_locks = 1;
|
||||
#ifndef NO_SIGNAL
|
||||
sethanguphandler((SIG_RET_TYPE) hangup);
|
||||
#endif
|
||||
@@ -227,7 +227,7 @@ nhmain(int argc, char *argv[])
|
||||
/* wizard mode access is deferred until here */
|
||||
set_playmode(); /* sets plname to "wizard" for wizard mode */
|
||||
/* hide any hyphens from plnamesuffix() */
|
||||
gp.plnamelen = exact_username ? (int) strlen(gp.plname) : 0;
|
||||
svp.plnamelen = exact_username ? (int) strlen(svp.plname) : 0;
|
||||
/* strip role,race,&c suffix; calls askname() if plname[] is empty
|
||||
or holds a generic user name like "player" or "games" */
|
||||
plnamesuffix();
|
||||
@@ -270,12 +270,12 @@ nhmain(int argc, char *argv[])
|
||||
* clock, &c not currently in use in the playground directory
|
||||
* (for gl.locknum > 0).
|
||||
*/
|
||||
if (*gp.plname) {
|
||||
if (*svp.plname) {
|
||||
getlock();
|
||||
gp.program_state.preserve_locks = 0; /* after getlock() */
|
||||
svp.program_state.preserve_locks = 0; /* after getlock() */
|
||||
}
|
||||
|
||||
if (*gp.plname && (nhfp = restore_saved_game()) != 0) {
|
||||
if (*svp.plname && (nhfp = restore_saved_game()) != 0) {
|
||||
const char *fq_save = fqname(gs.SAVEF, SAVEPREFIX, 1);
|
||||
|
||||
(void) chmod(fq_save, 0); /* disallow parallel restores */
|
||||
@@ -306,7 +306,7 @@ nhmain(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (!resuming) {
|
||||
boolean neednewlock = (!*gp.plname);
|
||||
boolean neednewlock = (!*svp.plname);
|
||||
/* new game: start by choosing role, race, etc;
|
||||
player might change the hero's name while doing that,
|
||||
in which case we try to restore under the new name
|
||||
@@ -315,7 +315,7 @@ nhmain(int argc, char *argv[])
|
||||
if (!plsel_once)
|
||||
player_selection();
|
||||
plsel_once = TRUE;
|
||||
if (neednewlock && *gp.plname)
|
||||
if (neednewlock && *svp.plname)
|
||||
goto attempt_restore;
|
||||
if (iflags.renameinprogress) {
|
||||
/* player has renamed the hero while selecting role;
|
||||
@@ -381,13 +381,13 @@ process_options(int argc, char *argv[])
|
||||
#endif
|
||||
case 'u':
|
||||
if (argv[0][2]) {
|
||||
(void) strncpy(gp.plname, argv[0] + 2, sizeof gp.plname - 1);
|
||||
gp.plnamelen = 0; /* plname[] might have -role-race attached */
|
||||
(void) strncpy(svp.plname, argv[0] + 2, sizeof svp.plname - 1);
|
||||
svp.plnamelen = 0; /* plname[] might have -role-race attached */
|
||||
} else if (argc > 1) {
|
||||
argc--;
|
||||
argv++;
|
||||
(void) strncpy(gp.plname, argv[0], sizeof gp.plname - 1);
|
||||
gp.plnamelen = 0;
|
||||
(void) strncpy(svp.plname, argv[0], sizeof svp.plname - 1);
|
||||
svp.plnamelen = 0;
|
||||
} else {
|
||||
raw_print("Player name expected after -u");
|
||||
}
|
||||
@@ -534,7 +534,7 @@ whoami(void)
|
||||
* Note that we trust the user here; it is possible to play under
|
||||
* somebody else's name.
|
||||
*/
|
||||
if (!*gp.plname) {
|
||||
if (!*svp.plname) {
|
||||
const char *s;
|
||||
|
||||
s = nh_getenv("USER");
|
||||
@@ -544,8 +544,8 @@ whoami(void)
|
||||
s = getlogin();
|
||||
|
||||
if (s && *s) {
|
||||
(void) strncpy(gp.plname, s, sizeof gp.plname - 1);
|
||||
if (strchr(gp.plname, '-'))
|
||||
(void) strncpy(svp.plname, s, sizeof svp.plname - 1);
|
||||
if (strchr(svp.plname, '-'))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -672,7 +672,7 @@ check_user_string(const char *optstr)
|
||||
if (optstr[0] == '*')
|
||||
return TRUE; /* allow any user */
|
||||
if (sysopt.check_plname)
|
||||
pwname = gp.plname;
|
||||
pwname = svp.plname;
|
||||
else if ((pw = get_unix_pw()) != 0)
|
||||
pwname = pw->pw_name;
|
||||
if (!pwname || !*pwname)
|
||||
@@ -1066,7 +1066,7 @@ void js_globals_init() {
|
||||
});
|
||||
|
||||
/* globals */
|
||||
CREATE_GLOBAL(gp.plname, "s");
|
||||
CREATE_GLOBAL(svp.plname, "s");
|
||||
|
||||
/* window globals */
|
||||
CREATE_GLOBAL(WIN_MAP, "i");
|
||||
|
||||
@@ -36,7 +36,7 @@ pckeys(unsigned char scancode, unsigned char shift)
|
||||
{
|
||||
boolean opening_dialog;
|
||||
|
||||
opening_dialog = gp.pl_character[0] ? FALSE : TRUE;
|
||||
opening_dialog = svp.pl_character[0] ? FALSE : TRUE;
|
||||
switch (scancode) {
|
||||
#ifdef SIMULATE_CURSOR
|
||||
case 0x3d: /* F3 = toggle cursor type */
|
||||
|
||||
@@ -794,7 +794,7 @@ vesa_cliparound(int x, int y)
|
||||
clipymax = ROWNO - 1;
|
||||
}
|
||||
if (clipx != oldx || clipy != oldy) {
|
||||
if (on_level(&u.uz0, &u.uz) && !gp.program_state.restoring)
|
||||
if (on_level(&u.uz0, &u.uz) && !svp.program_state.restoring)
|
||||
/* (void) doredraw(); */
|
||||
vesa_redrawmap();
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ vga_cliparound(int x, int y UNUSED)
|
||||
clipx = clipxmax - (viewport_size - 1);
|
||||
}
|
||||
if (clipx != oldx) {
|
||||
if (on_level(&u.uz0, &u.uz) && !gp.program_state.restoring)
|
||||
if (on_level(&u.uz0, &u.uz) && !svp.program_state.restoring)
|
||||
/* (void) doredraw(); */
|
||||
vga_redrawmap(1);
|
||||
}
|
||||
|
||||
@@ -411,19 +411,19 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
* overwritten without confirmation when a user starts up
|
||||
* another game with the same player name.
|
||||
*/
|
||||
Strcpy(gl.lock, gp.plname);
|
||||
Strcpy(gl.lock, svp.plname);
|
||||
regularize(gl.lock);
|
||||
getlock();
|
||||
#else /* What follows is !PC_LOCKING */
|
||||
#ifdef AMIGA /* We'll put the bones & levels in the user specified directory \
|
||||
-jhsa */
|
||||
Strcat(gl.lock, gp.plname);
|
||||
Strcat(gl.lock, svp.plname);
|
||||
Strcat(gl.lock, ".99");
|
||||
#else
|
||||
/* I'm not sure what, if anything, is left here, but old MFLOPPY had
|
||||
* conflicts with set_lock_and_bones() in files.c.
|
||||
*/
|
||||
Strcpy(gl.lock, gp.plname);
|
||||
Strcpy(gl.lock, svp.plname);
|
||||
Strcat(gl.lock, ".99");
|
||||
regularize(gl.lock); /* is this necessary? */
|
||||
/* not compatible with full path a la AMIGA */
|
||||
@@ -436,9 +436,9 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
if (!nhfp) {
|
||||
raw_print("Cannot create lock file");
|
||||
} else {
|
||||
gh.hackpid = 1;
|
||||
svh.hackpid = 1;
|
||||
if (nhfp->structlevel)
|
||||
write(nhfp->fd, (genericptr_t) &gh.hackpid, sizeof(gh.hackpid));
|
||||
write(nhfp->fd, (genericptr_t) &svh.hackpid, sizeof(svh.hackpid));
|
||||
close_nhfile(nhfp);
|
||||
}
|
||||
|
||||
@@ -549,11 +549,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;
|
||||
@@ -715,7 +715,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;
|
||||
}
|
||||
|
||||
@@ -179,8 +179,8 @@ gotlock:
|
||||
#endif
|
||||
error("cannot creat file (%s.)", fq_lock);
|
||||
} 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
|
||||
|
||||
@@ -99,7 +99,7 @@ main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
gh.hname = argv[0];
|
||||
gh.hackpid = getpid();
|
||||
svh.hackpid = getpid();
|
||||
(void) umask(0777 & ~FCMASK);
|
||||
|
||||
choose_windows(DEFAULT_WINDOW_SYS);
|
||||
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
|
||||
*/
|
||||
u.uhp = 1; /* prevent RIP on early quits */
|
||||
#if defined(HANGUPHANDLING)
|
||||
gp.program_state.preserve_locks = 1;
|
||||
svp.program_state.preserve_locks = 1;
|
||||
#ifndef NO_SIGNAL
|
||||
sethanguphandler((SIG_RET_TYPE) hangup);
|
||||
#endif
|
||||
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
|
||||
/* wizard mode access is deferred until here */
|
||||
set_playmode(); /* sets plname to "wizard" for wizard mode */
|
||||
/* hide any hyphens from plnamesuffix() */
|
||||
gp.plnamelen = exact_username ? (int) strlen(gp.plname) : 0;
|
||||
gp.plnamelen = exact_username ? (int) strlen(svp.plname) : 0;
|
||||
/* strip role,race,&c suffix; calls askname() if plname[] is empty
|
||||
or holds a generic user name like "player" or "games" */
|
||||
plnamesuffix();
|
||||
@@ -236,14 +236,14 @@ main(int argc, char *argv[])
|
||||
* clock, &c not currently in use in the playground directory
|
||||
* (for gl.locknum > 0).
|
||||
*/
|
||||
if (*gp.plname) {
|
||||
if (*svp.plname) {
|
||||
getlock();
|
||||
#if defined(HANGUPHANDLING)
|
||||
gp.program_state.preserve_locks = 0; /* after getlock() */
|
||||
svp.program_state.preserve_locks = 0; /* after getlock() */
|
||||
#endif
|
||||
}
|
||||
|
||||
if (*gp.plname && (nhfp = restore_saved_game()) != 0) {
|
||||
if (*svp.plname && (nhfp = restore_saved_game()) != 0) {
|
||||
const char *fq_save = fqname(gs.SAVEF, SAVEPREFIX, 1);
|
||||
|
||||
(void) chmod(fq_save, 0); /* disallow parallel restores */
|
||||
@@ -276,13 +276,13 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!resuming) {
|
||||
boolean neednewlock = (!*gp.plname);
|
||||
boolean neednewlock = (!*svp.plname);
|
||||
/* new game: start by choosing role, race, etc;
|
||||
player might change the hero's name while doing that,
|
||||
in which case we try to restore under the new name
|
||||
@@ -291,7 +291,7 @@ main(int argc, char *argv[])
|
||||
if (!plsel_once)
|
||||
player_selection();
|
||||
plsel_once = TRUE;
|
||||
if (neednewlock && *gp.plname)
|
||||
if (neednewlock && *svp.plname)
|
||||
goto attempt_restore;
|
||||
if (iflags.renameinprogress) {
|
||||
/* player has renamed the hero while selecting role;
|
||||
@@ -474,12 +474,12 @@ process_options(int argc, char *argv[])
|
||||
break;
|
||||
case 'u':
|
||||
if (arg[2]) {
|
||||
(void) strncpy(gp.plname, arg + 2, sizeof gp.plname - 1);
|
||||
(void) strncpy(svp.plname, arg + 2, sizeof svp.plname - 1);
|
||||
gp.plnamelen = 0; /* plname[] might have -role-race attached */
|
||||
} 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);
|
||||
gp.plnamelen = 0;
|
||||
} else {
|
||||
config_error_add("Character name expected after -u");
|
||||
@@ -916,7 +916,7 @@ whoami(void)
|
||||
* Note that we trust the user here; it is possible to play under
|
||||
* somebody else's name.
|
||||
*/
|
||||
if (!*gp.plname) {
|
||||
if (!*svp.plname) {
|
||||
register const char *s;
|
||||
|
||||
s = nh_getenv("USER");
|
||||
@@ -926,8 +926,8 @@ whoami(void)
|
||||
s = getlogin();
|
||||
|
||||
if (s && *s) {
|
||||
(void) strncpy(gp.plname, s, sizeof gp.plname - 1);
|
||||
if (strchr(gp.plname, '-'))
|
||||
(void) strncpy(svp.plname, s, sizeof svp.plname - 1);
|
||||
if (strchr(svp.plname, '-'))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1052,7 +1052,7 @@ check_user_string(const char *optstr)
|
||||
if (optstr[0] == '*')
|
||||
return TRUE; /* allow any user */
|
||||
if (sysopt.check_plname)
|
||||
pwname = gp.plname;
|
||||
pwname = svp.plname;
|
||||
else if ((pw = get_unix_pw()) != 0)
|
||||
pwname = pw->pw_name;
|
||||
if (!pwname || !*pwname)
|
||||
|
||||
@@ -82,7 +82,7 @@ eraseoldlocks(void)
|
||||
int i;
|
||||
|
||||
#if defined(HANGUPHANDLING)
|
||||
gp.program_state.preserve_locks = 0; /* not required but shows intent */
|
||||
svp.program_state.preserve_locks = 0; /* not required but shows intent */
|
||||
/* cannot use maxledgerno() here, because we need to find a lock name
|
||||
* before starting everything (including the dungeon initialization
|
||||
* that sets astral_level, needed for maxledgerno()) up
|
||||
@@ -132,7 +132,7 @@ getlock(void)
|
||||
'a','b',&c below; override the default and use <uid><charname>
|
||||
if we aren't restricting the number of simultaneous games */
|
||||
if (!gl.locknum)
|
||||
Sprintf(gl.lock, "%u%s", (unsigned) getuid(), gp.plname);
|
||||
Sprintf(gl.lock, "%u%s", (unsigned) getuid(), svp.plname);
|
||||
|
||||
regularize(gl.lock);
|
||||
set_levelfile_name(gl.lock, 0);
|
||||
@@ -216,7 +216,7 @@ getlock(void)
|
||||
}
|
||||
#ifdef SELF_RECOVER
|
||||
if (c == 'r' || c == 'R') {
|
||||
if (recover_savefile() && gp.program_state.in_self_recover) {
|
||||
if (recover_savefile() && svp.program_state.in_self_recover) {
|
||||
set_levelfile_name(gl.lock, 0);
|
||||
fq_lock = fqname(gl.lock, LEVELPREFIX, 0);
|
||||
goto gotlock;
|
||||
@@ -246,8 +246,8 @@ getlock(void)
|
||||
error("cannot creat lock file (%s).", fq_lock);
|
||||
/*NOTREACHED*/
|
||||
} else {
|
||||
if (write(fd, (genericptr_t) &gh.hackpid, sizeof gh.hackpid)
|
||||
!= sizeof gh.hackpid) {
|
||||
if (write(fd, (genericptr_t) &svh.hackpid, sizeof svh.hackpid)
|
||||
!= sizeof svh.hackpid) {
|
||||
error("cannot write lock (%s)", fq_lock);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ main(int argc, char *argv[])
|
||||
isn't at risk of getting clobbered by core's handling of DEBUGFILES */
|
||||
progname = dupstr(vms_basename(argv[0], FALSE));
|
||||
gh.hname = progname;
|
||||
gh.hackpid = getpid();
|
||||
svh.hackpid = getpid();
|
||||
(void) umask(0);
|
||||
|
||||
choose_windows(DEFAULT_WINDOW_SYS);
|
||||
@@ -281,11 +281,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;
|
||||
@@ -390,8 +390,8 @@ whoami(void)
|
||||
*/
|
||||
char *s;
|
||||
|
||||
if (!*gp.plname && (s = nh_getenv("USER")))
|
||||
(void) lcase(strncpy(gp.plname, s, sizeof(gp.plname) - 1));
|
||||
if (!*svp.plname && (s = nh_getenv("USER")))
|
||||
(void) lcase(strncpy(svp.plname, s, sizeof(svp.plname) - 1));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -412,7 +412,7 @@ byebye(void)
|
||||
(void) sys$delprc(&mail_pid, (genericptr_t) 0), mail_pid = 0;
|
||||
#endif
|
||||
#ifdef FREE_ALL_MEMORY
|
||||
if (progname && !gp.program_state.panicking) {
|
||||
if (progname && !svp.program_state.panicking) {
|
||||
if (gh.hname == progname)
|
||||
gh.hname = (char *) 0;
|
||||
free((genericptr_t) progname), progname = (char *) 0;
|
||||
@@ -421,7 +421,7 @@ byebye(void)
|
||||
|
||||
/* SIGHUP doesn't seem to do anything on VMS, so we fudge it here... */
|
||||
hup = (void (*)(int)) signal(SIGHUP, SIG_IGN);
|
||||
if (!gp.program_state.exiting++
|
||||
if (!svp.program_state.exiting++
|
||||
&& hup != (void (*)(int)) SIG_DFL
|
||||
&& hup != (void (*)(int)) SIG_IGN) {
|
||||
(*hup)(SIGHUP);
|
||||
@@ -446,7 +446,7 @@ genericptr_t mechargs) /* [0] is argc, [1..argc] are the real args */
|
||||
if (condition == SS$_ACCVIO /* access violation */
|
||||
|| (condition >= SS$_ASTFLT && condition <= SS$_TBIT)
|
||||
|| (condition >= SS$_ARTRES && condition <= SS$_INHCHME)) {
|
||||
gp.program_state.done_hup = TRUE; /* pretend hangup has been attempted */
|
||||
svp.program_state.done_hup = TRUE; /* pretend hangup has been attempted */
|
||||
#if (NH_DEVEL_STATUS == NH_STATUS_RELEASED)
|
||||
if (wizard)
|
||||
#endif
|
||||
|
||||
@@ -158,7 +158,7 @@ vms_getchar(void)
|
||||
static volatile int recurse = 0; /* SMG is not AST re-entrant! */
|
||||
#endif
|
||||
|
||||
if (gp.program_state.done_hup) {
|
||||
if (svp.program_state.done_hup) {
|
||||
/* hangup has occurred; do not attempt to get further user input */
|
||||
return ESC;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ getlock(void)
|
||||
'a','b',&c below; override the default and use <uid><charname>
|
||||
if we aren't restricting the number of simultaneous games */
|
||||
if (!gl.locknum)
|
||||
Sprintf(gl.lock, "_%u%s", (unsigned) getuid(), gp.plname);
|
||||
Sprintf(gl.lock, "_%u%s", (unsigned) getuid(), svp.plname);
|
||||
|
||||
regularize(gl.lock);
|
||||
set_levelfile_name(gl.lock, 0);
|
||||
@@ -154,8 +154,8 @@ getlock(void)
|
||||
if (fd == -1) {
|
||||
error("cannot creat lock file.");
|
||||
} 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)) {
|
||||
error("cannot write lock");
|
||||
}
|
||||
if (close(fd) == -1) {
|
||||
|
||||
@@ -936,7 +936,7 @@ void buffer_fill_to_end(cell_t * buffer, cell_t * fill, int x, int y)
|
||||
while (dst != sentinel)
|
||||
*dst++ = *fill;
|
||||
|
||||
if ((iflags.debug.immediateflips || !gp.program_state.in_moveloop)
|
||||
if ((iflags.debug.immediateflips || !svp.program_state.in_moveloop)
|
||||
&& buffer == console.back_buffer)
|
||||
back_buffer_flip();
|
||||
}
|
||||
@@ -952,7 +952,7 @@ static void buffer_clear_to_end_of_line(cell_t * buffer, int x, int y)
|
||||
while (dst != sentinel)
|
||||
*dst++ = clear_cell;
|
||||
|
||||
if (iflags.debug.immediateflips || !gp.program_state.in_moveloop)
|
||||
if (iflags.debug.immediateflips || !svp.program_state.in_moveloop)
|
||||
back_buffer_flip();
|
||||
}
|
||||
|
||||
@@ -964,7 +964,7 @@ void buffer_write(cell_t * buffer, cell_t * cell, COORD pos)
|
||||
cell_t * dst = buffer + (console.width * pos.Y) + pos.X;
|
||||
*dst = *cell;
|
||||
|
||||
if ((iflags.debug.immediateflips || !gp.program_state.in_moveloop)
|
||||
if ((iflags.debug.immediateflips || !svp.program_state.in_moveloop)
|
||||
&& buffer == console.back_buffer)
|
||||
back_buffer_flip();
|
||||
}
|
||||
@@ -1149,7 +1149,7 @@ tgetch(void)
|
||||
numpad |= 0x10;
|
||||
#endif
|
||||
|
||||
return (gp.program_state.done_hup)
|
||||
return (svp.program_state.done_hup)
|
||||
? '\033'
|
||||
: keyboard_handling.pCheckInput(
|
||||
console.hConIn, &ir, &count, numpad, 0, &mod, &cc);
|
||||
@@ -1177,7 +1177,7 @@ console_poskey(coordxy *x, coordxy *y, int *mod)
|
||||
if (gc.Cmd.swap_yz)
|
||||
numpad |= 0x10;
|
||||
#endif
|
||||
ch = (gp.program_state.done_hup)
|
||||
ch = (svp.program_state.done_hup)
|
||||
? '\033'
|
||||
: keyboard_handling.pCheckInput(
|
||||
console.hConIn, &ir, &count, numpad, 1, mod, &cc);
|
||||
|
||||
@@ -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