Merge branch 'NetHack-3.7' into keni-prefix

This commit is contained in:
nhkeni
2024-09-06 15:07:19 -04:00
202 changed files with 8527 additions and 6374 deletions

View File

@@ -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;
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;
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();
@@ -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() */
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,12 +381,12 @@ 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);
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 {
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");

View File

@@ -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 */

View File

@@ -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) && !program_state.restoring)
/* (void) doredraw(); */
vesa_redrawmap();
}

View File

@@ -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) && !program_state.restoring)
/* (void) doredraw(); */
vga_redrawmap(1);
}

View File

@@ -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;
}

View File

@@ -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

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: 1722119081 2024/07/27 22:24:41 $ $NHDT-Branch: keni-fetchlua $:$NHDT-Revision: 1.109 $
# Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
# NetHack may be freely redistributed. See license for details.
@@ -161,6 +161,16 @@ luabin:
( cd $(LUATOP) \
&& make $(LUAMAKEFILES) all && cd $(LUA2NHTOP) )
# This is only needed for some internal tools.
nhlua:
base=`ls -td lib/lua-*|head -1` ; \
[ -z $$base ] && $(MAKE) fetch-lua ; \
base=`ls -td lib/lua-*|head -1` ; \
cp -R $$base/ lib/nhlsrc ; \
rm -f util/nhlua ; \
( cd lib/nhlsrc && $(MAKE) clean posix ) ; \
cp lib/nhlsrc/src/lua util/nhlua
# hints file could set LUATESTTARGET to this if GITSUBMODULES is defined
submodules/lua/lua.h:
git submodule init submodules/lua
@@ -322,45 +332,55 @@ dofiles-nodlb:
LUA_URL :=www.lua.org/ftp
LUA_URL_MIRROR :=www.tecgraf.puc-rio.br/lua/mirror/ftp
LUA_URL_NHD :=www.nethack.org/download/thirdparty
LUA_URL_list:=$(LUA_URL) $(LUA_URL_MIRROR) $(LUA_URL_NHD)
fetch-lua-mirror: LUA_URL :=$(LUA_URL_MIRROR)
fetch-lua-mirror: LUA_URL_list:=$(LUA_URL_MIRROR)
fetch-lua-mirror: fetch-Lua
@true
fetch-lua-nhd: LUA_URL_list:=$(LUA_URL_NHD)
fetch-lua-nhd: fetch-Lua
@true
fetch-lua: fetch-Lua
@true
fetch-Lua:
@( mkdir -p lib && cd lib && \
n=0; \
@( \
shac1=`command -v shasum`; \
shac2=`command -v sha256sum`; \
if [ ! -z $$shac1 ]; then \
shac="$$shac1 -a 256"; elif [ ! -z $$shac2 ]; then \
shac=$$shac2; else echo "CAUTION: no way to check integrity"; \
fi; \
set -- DUMMY $(LUA_URL_list); \
luafile=lua-$(LUA_VERSION).tar.gz; \
export curlstatus=1; \
while [ $${n} -lt 2 ]; do \
mkdir -p lib && cd lib && \
while [ $$# -gt 0 ]; do \
shift; \
if [ $$curlstatus -ne 0 ]; then \
if [ $${n} -eq 0 ]; then \
luaurl=https://$(LUA_URL)/lua-$(LUA_VERSION).tar.gz; \
fi; \
if [ $${n} -eq 1 ]; then \
luaurl=https://$(LUA_URL_MIRROR)/lua-$(LUA_VERSION).tar.gz; \
fi; \
echo trying $$luaurl; \
shac1=`command -v shasum`; \
shac2=`command -v sha256sum`; \
if [ ! -z $$shac1 ]; then \
shac="$$shac1 -a 256"; elif [ ! -z $$shac2 ]; then \
shac=$$shac2; else echo "CAUTION: no way to check integrity"; \
fi; \
luaurl=https://$$1/$$luafile; \
echo Trying $$luaurl; \
curl -R -O $$luaurl; \
export curlstatus=$$?; \
curlstatus=$$?; \
if [ $$curlstatus -eq 0 ]; then \
if [ ! -z "$$shac" ]; then \
echo Checking integrity with $$shac; \
$$shac -w -c ../submodules/CHKSUMS < lua-$(LUA_VERSION).tar.gz; \
CHKSUMS=../submodules/CHKSUMS; \
CHKSUMSTMP=../submodules/CHKSUMS.tmp; \
fgrep $$luafile < $$CHKSUMS > $$CHKSUMSTMP; \
if [ -z $$CHKSUMSTMP ]; then \
echo "Cannot check $$luafile - no checksum known"; \
else \
echo Checking integrity of $$luafile with $$shac; \
$$shac -w --ignore-missing -c $$CHKSUMSTMP < $$luafile; \
fi; \
fi; \
tar zxf lua-$(LUA_VERSION).tar.gz && \
rm -f lua-$(LUA_VERSION).tar.gz; \
tar zxf $$luafile && \
rm -f $$luafile; \
fi; \
fi; \
n=`expr $$n + 1`; \
done; \
true )

View File

@@ -7,6 +7,19 @@
objects = {
/* Begin PBXBuildFile section */
056E43C62C810EE800FD1F52 /* coloratt.c in Sources */ = {isa = PBXBuildFile; fileRef = 056E43BC2C810EE800FD1F52 /* coloratt.c */; };
056E43C72C810EE800FD1F52 /* nhmd4.c in Sources */ = {isa = PBXBuildFile; fileRef = 056E43C02C810EE800FD1F52 /* nhmd4.c */; };
056E43C82C810EE800FD1F52 /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = 056E43BF2C810EE800FD1F52 /* Makefile */; };
056E43C92C810EE800FD1F52 /* report.c in Sources */ = {isa = PBXBuildFile; fileRef = 056E43C12C810EE800FD1F52 /* report.c */; };
056E43CA2C810EE800FD1F52 /* selvar.c in Sources */ = {isa = PBXBuildFile; fileRef = 056E43C22C810EE800FD1F52 /* selvar.c */; };
056E43CB2C810EE800FD1F52 /* calendar.c in Sources */ = {isa = PBXBuildFile; fileRef = 056E43BB2C810EE800FD1F52 /* calendar.c */; };
056E43CC2C810EE800FD1F52 /* stairs.c in Sources */ = {isa = PBXBuildFile; fileRef = 056E43C32C810EE800FD1F52 /* stairs.c */; };
056E43CD2C810EE800FD1F52 /* glyphs.c in Sources */ = {isa = PBXBuildFile; fileRef = 056E43BE2C810EE800FD1F52 /* glyphs.c */; };
056E43CE2C810EE800FD1F52 /* strutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 056E43C42C810EE800FD1F52 /* strutil.c */; };
056E43CF2C810EE800FD1F52 /* getpos.c in Sources */ = {isa = PBXBuildFile; fileRef = 056E43BD2C810EE800FD1F52 /* getpos.c */; };
056E43D02C810EE800FD1F52 /* wizcmds.c in Sources */ = {isa = PBXBuildFile; fileRef = 056E43C52C810EE800FD1F52 /* wizcmds.c */; };
059660BE2C80B00400398EDE /* hacklib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A36421A238040055BD01 /* hacklib.c */; };
059660C12C80B0C700398EDE /* hacklib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A36421A238040055BD01 /* hacklib.c */; };
31B8A30C21A20D8B0055BD01 /* makedefs.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A30B21A20D8B0055BD01 /* makedefs.c */; };
31B8A30F21A20DC10055BD01 /* objects.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A30D21A20DC10055BD01 /* objects.c */; };
31B8A31021A20DC10055BD01 /* monst.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A30E21A20DC10055BD01 /* monst.c */; };
@@ -244,6 +257,15 @@
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
059660C42C80B15300398EDE /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
dstPath = /usr/share/man/man1;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
3189576F21A1FCC100FB2ABE /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -271,18 +293,20 @@
);
runOnlyForDeploymentPostprocessing = 1;
};
31B8A45521A26A970055BD01 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
056E43BB2C810EE800FD1F52 /* calendar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = calendar.c; path = ../../src/calendar.c; sourceTree = "<group>"; };
056E43BC2C810EE800FD1F52 /* coloratt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = coloratt.c; path = ../../src/coloratt.c; sourceTree = "<group>"; };
056E43BD2C810EE800FD1F52 /* getpos.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = getpos.c; path = ../../src/getpos.c; sourceTree = "<group>"; };
056E43BE2C810EE800FD1F52 /* glyphs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = glyphs.c; path = ../../src/glyphs.c; sourceTree = "<group>"; };
056E43BF2C810EE800FD1F52 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../src/Makefile; sourceTree = "<group>"; };
056E43C02C810EE800FD1F52 /* nhmd4.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = nhmd4.c; path = ../../src/nhmd4.c; sourceTree = "<group>"; };
056E43C12C810EE800FD1F52 /* report.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = report.c; path = ../../src/report.c; sourceTree = "<group>"; };
056E43C22C810EE800FD1F52 /* selvar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = selvar.c; path = ../../src/selvar.c; sourceTree = "<group>"; };
056E43C32C810EE800FD1F52 /* stairs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = stairs.c; path = ../../src/stairs.c; sourceTree = "<group>"; };
056E43C42C810EE800FD1F52 /* strutil.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = strutil.c; path = ../../src/strutil.c; sourceTree = "<group>"; };
056E43C52C810EE800FD1F52 /* wizcmds.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = wizcmds.c; path = ../../src/wizcmds.c; sourceTree = "<group>"; };
2A953FB221A3F404007906E5 /* XCode.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = XCode.xcconfig; sourceTree = "<group>"; };
3186A36D21A4B0F90052BF02 /* xwindowp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xwindowp.h; path = ../../include/xwindowp.h; sourceTree = "<group>"; };
3186A36E21A4B0FA0052BF02 /* botl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = botl.h; path = ../../include/botl.h; sourceTree = "<group>"; };
@@ -628,6 +652,17 @@
3189578C21A1FF8200FB2ABE /* src */ = {
isa = PBXGroup;
children = (
056E43BB2C810EE800FD1F52 /* calendar.c */,
056E43BC2C810EE800FD1F52 /* coloratt.c */,
056E43BD2C810EE800FD1F52 /* getpos.c */,
056E43BE2C810EE800FD1F52 /* glyphs.c */,
056E43BF2C810EE800FD1F52 /* Makefile */,
056E43C02C810EE800FD1F52 /* nhmd4.c */,
056E43C12C810EE800FD1F52 /* report.c */,
056E43C22C810EE800FD1F52 /* selvar.c */,
056E43C32C810EE800FD1F52 /* stairs.c */,
056E43C42C810EE800FD1F52 /* strutil.c */,
056E43C52C810EE800FD1F52 /* wizcmds.c */,
54A3D3EB282C55A900143F8C /* utf8map.c */,
54435B51247999CB00804CB3 /* nhlobj.c */,
54FB2B4A246310A600397C0E /* symbols.c */,
@@ -1022,6 +1057,7 @@
3189577C21A1FDA400FB2ABE /* Frameworks */,
3189577D21A1FDA400FB2ABE /* CopyFiles */,
317E7C4B21A35F0500F6E4E5 /* Copy makedefs */,
059660C02C80B07100398EDE /* Codesign makedefs */,
319CBA3821A3458100150830 /* Build data */,
317E7C4521A3548F00F6E4E5 /* Build rumors */,
317E7C4E21A3697300F6E4E5 /* Build options */,
@@ -1045,6 +1081,8 @@
31B8A44621A26A4B0055BD01 /* Sources */,
31B8A44721A26A4B0055BD01 /* Frameworks */,
31B8A44821A26A4B0055BD01 /* CopyFiles */,
059660C32C80B12300398EDE /* Copy recover */,
059660C52C80B1A000398EDE /* Codesign recover */,
);
buildRules = (
);
@@ -1062,8 +1100,9 @@
buildPhases = (
31B8A45321A26A970055BD01 /* Sources */,
31B8A45421A26A970055BD01 /* Frameworks */,
31B8A45521A26A970055BD01 /* CopyFiles */,
3192867221A3AA5700325BEB /* copy dlb */,
059660C42C80B15300398EDE /* CopyFiles */,
3192867221A3AA5700325BEB /* Copy dlb */,
059660C22C80B0FD00398EDE /* Codesign dlb */,
);
buildRules = (
);
@@ -1084,6 +1123,7 @@
BAE8010727B97760002B3786 /* Sources */,
BAE8010827B97760002B3786 /* Frameworks */,
BAE8010F27B9825E002B3786 /* Build nhlua.h */,
056E43A42C81094100FD1F52 /* Copy libnhlua.a */,
);
buildRules = (
);
@@ -1143,6 +1183,97 @@
/* End PBXProject section */
/* Begin PBXShellScriptBuildPhase section */
056E43A42C81094100FD1F52 /* Copy libnhlua.a */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Copy libnhlua.a";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"Copying ${BUILT_PRODUCTS_DIR}/libnhlua.a to ${NH_LIB_DIR}/libnhlua.a\"\ncp \"${BUILT_PRODUCTS_DIR}\"/libnhlua.a \"${NH_LIB_DIR}\"/libnhlua.a\necho \"Copying ${BUILT_PRODUCTS_DIR}/libnhlua.a to ${NH_LIB_DIR}/libnhlua.a\"\ncp \"${BUILT_PRODUCTS_DIR}\"/libnhlua.a \"${NH_LIB_DIR}\"/libnhlua.a\n";
};
059660C02C80B07100398EDE /* Codesign makedefs */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Codesign makedefs";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "codesign --force --deep -s - \"${NH_UTIL_DIR}\"/makedefs\n";
};
059660C22C80B0FD00398EDE /* Codesign dlb */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Codesign dlb";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "codesign --force --deep -s - \"${NH_UTIL_DIR}\"/dlb\n";
};
059660C32C80B12300398EDE /* Copy recover */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Copy recover";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cp \"${BUILT_PRODUCTS_DIR}\"/recover \"${NH_UTIL_DIR}\"/recover\n";
};
059660C52C80B1A000398EDE /* Codesign recover */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Codesign recover";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "codesign --force --deep -s - \"${NH_UTIL_DIR}\"/recover\n";
};
317E7C4521A3548F00F6E4E5 /* Build rumors */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -1466,7 +1597,7 @@
shellPath = /bin/sh;
shellScript = "cp \"${BUILT_PRODUCTS_DIR}\"/nethack \"${NH_SRC_DIR}\"/nethack\n";
};
3192867221A3AA5700325BEB /* copy dlb */ = {
3192867221A3AA5700325BEB /* Copy dlb */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -1476,7 +1607,7 @@
inputPaths = (
"${BUILT_PRODUCTS_DIR}/dlb",
);
name = "copy dlb";
name = "Copy dlb";
outputFileListPaths = (
);
outputPaths = (
@@ -1545,7 +1676,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd $NH_ROOT_DIR\necho LUA VERSION: $LUA_VERSION\nif test ! -d lib/lua-$LUA_VERSION ; then ( echo \"Fetching $LUA_VERSION\" && \\\n mkdir -p lib && cd lib && \\\n curl -s -S -R -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz && \\\n tar zxf lua-$LUA_VERSION.tar.gz && \\\n rm -f lua-$LUA_VERSION.tar.gz ) ; fi\n";
shellScript = "cd $NH_ROOT_DIR\necho LUA VERSION: $LUA_VERSION\nif test ! -d lib/lua-$LUA_VERSION ; then ( echo \"Fetching $LUA_VERSION\" && \\\n mkdir -p lib && cd lib && \\\n curl -s -S -R -O https://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz && \\\n tar zxf lua-$LUA_VERSION.tar.gz && \\\n rm -f lua-$LUA_VERSION.tar.gz ) ; fi\n";
};
BAE8010F27B9825E002B3786 /* Build nhlua.h */ = {
isa = PBXShellScriptBuildPhase;
@@ -1616,6 +1747,17 @@
31B8A3CB21A238060055BD01 /* alloc.c in Sources */,
31B8A39821A238060055BD01 /* mail.c in Sources */,
31B8A3C821A238060055BD01 /* options.c in Sources */,
056E43C62C810EE800FD1F52 /* coloratt.c in Sources */,
056E43C72C810EE800FD1F52 /* nhmd4.c in Sources */,
056E43C82C810EE800FD1F52 /* Makefile in Sources */,
056E43C92C810EE800FD1F52 /* report.c in Sources */,
056E43CA2C810EE800FD1F52 /* selvar.c in Sources */,
056E43CB2C810EE800FD1F52 /* calendar.c in Sources */,
056E43CC2C810EE800FD1F52 /* stairs.c in Sources */,
056E43CD2C810EE800FD1F52 /* glyphs.c in Sources */,
056E43CE2C810EE800FD1F52 /* strutil.c in Sources */,
056E43CF2C810EE800FD1F52 /* getpos.c in Sources */,
056E43D02C810EE800FD1F52 /* wizcmds.c in Sources */,
31B8A3CD21A238060055BD01 /* write.c in Sources */,
31B8A40F21A23EEC0055BD01 /* cursmesg.c in Sources */,
31B8A3DF21A238060055BD01 /* end.c in Sources */,
@@ -1716,6 +1858,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
059660BE2C80B00400398EDE /* hacklib.c in Sources */,
544A5CF0277B40CF00734B53 /* panic.c in Sources */,
5493735A277AAE830031FE02 /* alloc.c in Sources */,
5439B3BC275AADC600B8FB2F /* date.c in Sources */,
@@ -1737,6 +1880,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
059660C12C80B0C700398EDE /* hacklib.c in Sources */,
31B8A46121A26AF60055BD01 /* panic.c in Sources */,
31B8A45E21A26ACF0055BD01 /* dlb.c in Sources */,
31B8A46021A26AE70055BD01 /* dlb_main.c in Sources */,
@@ -2003,6 +2147,23 @@
GCC_C_LANGUAGE_STANDARD = c99;
INSTALL_PATH = "$(NH_INSTALL_DIR)";
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
OTHER_CFLAGS = (
"-DNOMAIL",
"-DNOTPARMDECL",
"-DDEFAULT_WINDOW_SYS=\\\"tty\\\"",
"-DDLB",
"-DGREPPATH=\\\"/usr/bin/grep\\\"",
"-DSYSCF",
"-DSYSCF_FILE=\\\"$(NH_INSTALL_DIR)/sysconf\\\"",
"-DHACKDIR=\\\"$(NH_INSTALL_DIR)\\\"",
"-DSECURE",
"-DCURSES_GRAPHICS",
"-DSND_LIB_MACSOUND",
"-DSND_SOUNDEFFECTS_AUTOMAP",
"-DUSER_SOUNDS",
"-DCURSES_UNICODE",
"-D_XOPEN_SOURCE_EXTENDED",
);
"OTHER_LDFLAGS[arch=*]" = "-L${NH_LIB_DIR}/lua";
PRODUCT_NAME = "$(TARGET_NAME)";
};
@@ -2017,6 +2178,20 @@
GCC_C_LANGUAGE_STANDARD = c99;
INSTALL_PATH = "$(NH_INSTALL_DIR)";
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
OTHER_CFLAGS = (
"-DNOMAIL",
"-DNOTPARMDECL",
"-DDEFAULT_WINDOW_SYS=\\\"tty\\\"",
"-DDLB",
"-DGREPPATH=\\\"/usr/bin/grep\\\"",
"-DSYSCF",
"-DSYSCF_FILE=\\\"$(NH_INSTALL_DIR)/sysconf\\\"",
"-DHACKDIR=\\\"$(NH_INSTALL_DIR)\\\"",
"-DSECURE",
"-DCURSES_GRAPHICS",
"-DCURSES_UNICODE",
"-D_XOPEN_SOURCE_EXTENDED",
);
"OTHER_LDFLAGS[arch=*]" = "-L${NH_LIB_DIR}/lua";
PRODUCT_NAME = "$(TARGET_NAME)";
};

View File

@@ -82,10 +82,10 @@ dodata:
endif # CROSS_TO_MSDOS
ifdef CROSS_TO_WASM
$(WASM_TARGET): pregame $(TARGETPFX)date.o $(HOSTOBJ) $(HOBJ) $(LUACROSSLIB) $(WASM_DATA_DIR)
$(WASM_TARGET): pregame $(TARGET_HACKLIB) $(TARGETPFX)date.o $(HOSTOBJ) $(HOBJ) $(LUACROSSLIB) $(WASM_DATA_DIR)
-rm $@
$(TARGET_CC) $(TARGET_LFLAGS) $(TARGET_CFLAGS) -o $@ \
$(HOBJ) $(TARGETPFX)date.o $(TARGET_LIBS)
$(HOBJ) $(TARGETPFX)date.o $(TARGET_HACKLIB) $(TARGET_LIBS)
$(WASM_DATA_DIR): $(WASM_DATA_DIR)/nhdat
touch $(WASM_DATA_DIR)/perm

View File

@@ -275,7 +275,8 @@ WASM_CFLAGS += -Wshadow
# Nethack C flags
WASM_CFLAGS += $(WINCFLAGS) #WINCFLAGS set from multiw-2.370
WASM_CFLAGS += -DSYSCF -DSYSCF_FILE=\"/sysconf\" -DSECURE
WASM_CFLAGS += -g -I../include -DNOTPARMDECL
#WASM_CFLAGS += -g -I../include -DNOTPARMDECL
WASM_CFLAGS += -I../include -DNOTPARMDECL
# NetHack sources control
WASM_CFLAGS += -DDLB
WASM_CFLAGS += -DHACKDIR=\"$(HACKDIR)\"

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*/
}

View File

@@ -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 && !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 (!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 */
program_state.done_hup = TRUE; /* pretend hangup has been attempted */
#if (NH_DEVEL_STATUS == NH_STATUS_RELEASED)
if (wizard)
#endif

View File

@@ -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 (program_state.done_hup) {
/* hangup has occurred; do not attempt to get further user input */
return ESC;
}

View File

@@ -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) {

View File

@@ -8,8 +8,8 @@
# MS Visual Studio Visual C++ compiler
#
# Visual Studio Compilers Tested:
# - Microsoft Visual Studio 2019 Community Edition v 16.11.37
# - Microsoft Visual Studio 2022 Community Edition v 17.10.2
# - Microsoft Visual Studio 2019 Community Edition v 16.11.38
# - Microsoft Visual Studio 2022 Community Edition v 17.11.2
#
#==============================================================================
# This is used for building two distinct executables of NetHack:
@@ -989,7 +989,7 @@ rc=Rc.exe
#
# Recently tested versions:
TESTEDVS2019 = 14.29.30154.0
TESTEDVS2022 = 14.40.33811.0
TESTEDVS2022 = 14.41.34120.0
VS2019CUR = $(TESTEDVS2019:.=)
VS2022CUR = $(TESTEDVS2022:.=)

View File

@@ -4,30 +4,16 @@ Prerequisite Requirements:
o MSYS2
- https://www.msys2.org/
- Download the installer, and start the UCRT64 shell.
- Download and run the installer, and start the UCRT64 shell.
then
pacman -S mingw-w64-ucrt-x86_64-gcc
pacman -S git
pacman -S make
pacman -S vim (or your editor of choice)
pacman -S man (otherwise "git help foo" will not work)
o Lua
NetHack 3.7 for Windows requires 3rd party Lua source that is not part
of the NetHack distribution or repository.
A windows cmd command procedure for fetching prerequisite sources
is available, and can be run as follows from the top of the
NetHack source tree to obtain lua:
sys\windows\fetch.cmd lua
o pdcursesmod (Only required if curses interface support is desired)
If you want to include curses interface support in NetHack 3.7 for
3rd part pdcursesmod source code is required and is not part of the
NetHack distribution or repository.
A windows cmd command procedure for fetching prerequisite
sources is available, and can be run as follows from the top of
the NetHack source tree to obtain pdcursesmod:
sys\windows\fetch.cmd pdcursesmod
Instructions for obtaining these are later in this file.
/---------------------------------------------\
| Directories for a Windows NetHack build |
@@ -81,23 +67,22 @@ Building
Two different versions of NetHack will be built for Windows from the
command line using the Makefile approach:
A tty port utilizing the Win32 Console I/O subsystem Console,
and a curses interface in an executabled called NetHack.exe.
NetHack
and a curses interface in an executable called NetHack.exe.
A Win32 native port built on the Windows API Graphical NetHack,
and graphical curses in an executable called NetHackW.exe.
The Makefile configurations will build both; NetHack.exe and NetHackW.exe
The Makefile configurations will build both NetHack.exe and NetHackW.exe
and will be able to use the same datafiles, save files and bones files.
Since the last official release of NetHack, compilers and computer
architectures have evolved and you can now choose whether to build
a 32-bit x86 version, or a 64-bit x64 version. The default Makefile
is set up for a 32-bit x86 version, but that's only because it will
run on the most number of existing Windows environments. Change it if you
run on the largest number of existing Windows environments. Change it if you
want. Be aware that NetHack's save files and bones files in the 3.7.0
release have not yet evolved enough to allow them to interchange between
the 32-bit version and the 64-bit version (or between different platforms).
That may change in future.
release are not interchangeable between the 32-bit version and the
64-bit version (or between different platforms).
I. Dispelling the Myths:
@@ -147,7 +132,7 @@ Notes:
1. To rebuild NetHack after changing something, change your current directory
to src and issue the appropriate command for your compiler:
For Microsoft compiler:
For gcc:
make -f Makefile.mingw32
2. An alternative to MSYS2 may be MinGW-w64 - winlibs standalone build.

View File

@@ -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 || !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 || !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 || !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 (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 = (program_state.done_hup)
? '\033'
: keyboard_handling.pCheckInput(
console.hConIn, &ir, &count, numpad, 1, mod, &cc);

View File

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