Merge branch 'NetHack-3.7' into keni-fetchlua

This commit is contained in:
nhkeni
2024-07-26 20:20:34 -04:00
185 changed files with 4962 additions and 3959 deletions

View File

@@ -1,5 +1,5 @@
# NetHack Top-level Makefile.
# NetHack 3.7 Makefile.top $NHDT-Date: 1693519381 2023/08/31 22:03:01 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.91 $
# NetHack 3.7 Makefile.top $NHDT-Date: 1722019636 2024/07/26 18:47:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.106 $
# Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
# NetHack may be freely redistributed. See license for details.
@@ -352,8 +352,8 @@ fetch-Lua:
curlstatus=$$?; \
if [ $$curlstatus -eq 0 ]; then \
if [ ! -z "$$shac" ]; then \
echo Checking integrity with $$shac; \
$$shac -w -c ../submodules/CHKSUMS < $$luafile; \
echo Checking integrity of $$luafile with $$shac; \
$$shac -w --ignore-missing -c ../submodules/CHKSUMS < $$luafile; \
fi; \
tar zxf $$luafile && \
rm -f $$luafile; \

View File

@@ -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;
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() */
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 (program_state.in_self_recover) {
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)

View File

@@ -82,7 +82,7 @@ eraseoldlocks(void)
int i;
#if defined(HANGUPHANDLING)
gp.program_state.preserve_locks = 0; /* not required but shows intent */
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() && 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*/
}