Merge branch 'master' into nhmall-booktribute
Conflicts: sys/winnt/Makefile.msc
This commit is contained in:
55
DEVEL/code_features.txt
Normal file
55
DEVEL/code_features.txt
Normal file
@@ -0,0 +1,55 @@
|
||||
$NHDT-Date: 1426969026 2015/03/21 20:17:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.137 $
|
||||
code_features.txt
|
||||
|
||||
Developer-useful info about code features, assumptions, purpose,
|
||||
rationale, etc.
|
||||
|
||||
==============================================
|
||||
PREFIXES_IN_USE and NOCWD_ASSUMPTIONS
|
||||
|
||||
Those provide a storage mechanism for holding the paths to various different
|
||||
types of files. Those paths are stored in the fqn_prefix[] array. They are a
|
||||
mechanism for enabling separation of the different files that NetHack needs.
|
||||
|
||||
The prefixes are added to the beginning of file names by various routines in
|
||||
files.c immediately prior to opening one of the types of files that the game
|
||||
uses.
|
||||
|
||||
They aren't about config file options (although config file options would be
|
||||
one way to set non-default values for some of the paths in the fqn_prefix[]
|
||||
array). Obviously the very first path needed (now sysconfdir, previously
|
||||
configdir) isn't viable for setting via config file options, but the game
|
||||
still needs to hunt it down "someplace." When the "someplace" is figured
|
||||
out, that place (path) would be stored in fqn_prefix[SYSCONPREFIX]. How it
|
||||
gets stored in fqn_prefix[SYSCONPREFIX] is up to us as developers.
|
||||
|
||||
Any of the fqn_prefix[] entries can be set somehow. It could be done in port
|
||||
startup code; in options processing; in config file processing; by
|
||||
translating a system environment variable such as USERPROFILE; whatever
|
||||
you/we want. The point is that NOCWD_ASSUMPTIONS and PREFIXES_IN_USE are
|
||||
there to ensure that there is a place to store that path information. The
|
||||
code to *utilize* the information is already in files.c (see fqname()).
|
||||
|
||||
There is a fqn_prefix[] entry for holding the path to each of the following:
|
||||
PREFIX NAME
|
||||
0 HACKPREFIX hackdir
|
||||
1 LEVELPREFIX leveldir location to create level files
|
||||
2 SAVEPREFIX savedir location to create/read saved games
|
||||
3 BONESPREFIX bonesir location to create/read bones
|
||||
4 DATAPREFIX datadir location to read data.base etc.
|
||||
5 SCOREPREFIX scoredir location to read/write scorefile
|
||||
6 LOCKPREFIX lockdir location to create/read lock files
|
||||
7 SYSCONFPREFIX sysconfdir location to read SYSCF_FILE
|
||||
8 CONFIGPREFIX configdir location to read user configuration file
|
||||
9 TROUBLEPREFIX troubledir location to place panic files etc.
|
||||
|
||||
To recap, they are about enabling "different paths for different things", and
|
||||
separation of:
|
||||
- read-only stuff from read-write stuff.
|
||||
- sysadmin stuff from user-writeable stuff.
|
||||
etc.
|
||||
|
||||
=================== NEXT FEATURE ==========================
|
||||
|
||||
|
||||
|
||||
@@ -184,6 +184,7 @@ E NEARDATA struct kinfo {
|
||||
|
||||
E long done_money;
|
||||
E const char *configfile;
|
||||
E char lastconfigfile[BUFSZ]; /* used for messaging */
|
||||
E NEARDATA char plname[PL_NSIZ];
|
||||
E NEARDATA char dogname[];
|
||||
E NEARDATA char catname[];
|
||||
@@ -362,9 +363,10 @@ E const char * const monexplain[], invisexplain[], * const oclass_names[];
|
||||
#define DATAPREFIX 4 /* this one must match hardcoded value in dlb.c */
|
||||
#define SCOREPREFIX 5
|
||||
#define LOCKPREFIX 6
|
||||
#define CONFIGPREFIX 7
|
||||
#define TROUBLEPREFIX 8
|
||||
#define PREFIX_COUNT 9
|
||||
#define SYSCONFPREFIX 7
|
||||
#define CONFIGPREFIX 8
|
||||
#define TROUBLEPREFIX 9
|
||||
#define PREFIX_COUNT 10
|
||||
/* used in files.c; xxconf.h can override if needed */
|
||||
# ifndef FQN_MAX_FILENAME
|
||||
#define FQN_MAX_FILENAME 512
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 extern.h $NHDT-Date: 1426496453 2015/03/16 09:00:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.407 $ */
|
||||
/* NetHack 3.5 extern.h $NHDT-Date: 1426966688 2015/03/21 19:38:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.411 $ */
|
||||
/* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -740,6 +740,9 @@ E void FDECL(free_saved_games, (char**));
|
||||
#ifdef SELF_RECOVER
|
||||
E boolean NDECL(recover_savefile);
|
||||
#endif
|
||||
#ifdef SYSCF_FILE
|
||||
E void NDECL(assure_syscf_file);
|
||||
#endif
|
||||
#ifdef HOLD_LOCKFILE_OPEN
|
||||
E void NDECL(really_close);
|
||||
#endif
|
||||
@@ -2290,9 +2293,6 @@ E void NDECL(port_help);
|
||||
E void FDECL(sethanguphandler, (void (*)(int)));
|
||||
E boolean NDECL(authorize_wizard_mode);
|
||||
E boolean FDECL(check_user_string, (char *));
|
||||
# ifdef SYSCF_FILE
|
||||
E void NDECL(assure_syscf_file);
|
||||
# endif
|
||||
#endif /* UNIX */
|
||||
|
||||
/* ### unixtty.c ### */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 ntconf.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 ntconf.h $NHDT-Date: 1426966690 2015/03/21 19:38:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.37 $ */
|
||||
/* NetHack 3.5 ntconf.h $Date: 2012/01/15 19:11:38 $ $Revision: 1.35 $ */
|
||||
/* SCCS Id: @(#)ntconf.h 3.5 2002/03/10 */
|
||||
/* Copyright (c) NetHack PC Development Team 1993, 1994. */
|
||||
@@ -25,6 +25,9 @@
|
||||
|
||||
#define SELF_RECOVER /* Allow the game itself to recover from an aborted game */
|
||||
|
||||
#define SYSCF /* Use a global configuration */
|
||||
#define SYSCF_FILE "sysconf" /* Use a file to hold the SYSCF configuration */
|
||||
|
||||
#define USER_SOUNDS
|
||||
|
||||
#ifdef WIN32CON
|
||||
|
||||
@@ -268,12 +268,14 @@ char toplines[TBUFSZ];
|
||||
struct tc_gbl_data tc_gbl_data = { 0,0, 0,0 }; /* AS,AE, LI,CO */
|
||||
|
||||
char *fqn_prefix[PREFIX_COUNT] = { (char *)0, (char *)0, (char *)0, (char *)0,
|
||||
(char *)0, (char *)0, (char *)0, (char *)0, (char *)0 };
|
||||
(char *)0, (char *)0, (char *)0, (char *)0,
|
||||
(char *)0 , (char *)0 };
|
||||
|
||||
#ifdef PREFIXES_IN_USE
|
||||
char *fqn_prefix_names[PREFIX_COUNT] = { "hackdir", "leveldir", "savedir",
|
||||
"bonesdir", "datadir", "scoredir",
|
||||
"lockdir", "configdir", "troubledir" };
|
||||
"lockdir", "sysconfdir", "configdir",
|
||||
"troubledir" };
|
||||
#endif
|
||||
|
||||
NEARDATA struct savefile_info sfcap = {
|
||||
|
||||
23
src/do.c
23
src/do.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 do.c $NHDT-Date: 1426497723 2015/03/16 09:22:03 $ $NHDT-Branch: H3724 $:$NHDT-Revision: 1.109 $ */
|
||||
/* NetHack 3.5 do.c $NHDT-Date: 1426991040 2015/03/22 02:24:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.111 $ */
|
||||
/* NetHack 3.5 do.c $Date: 2014/11/18 03:10:39 $ $Revision: 1.101 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1014,15 +1014,18 @@ boolean at_stairs, falling, portal;
|
||||
|
||||
/* If you have the amulet and are trying to get out of Gehennom, going
|
||||
* up a set of stairs sometimes does some very strange things!
|
||||
* Biased against law and towards chaos, but not nearly as strongly
|
||||
* as it used to be (prior to 3.2.0).
|
||||
* Odds: old new
|
||||
* "up" L N C "up" L N C
|
||||
* +1 75.0 75.0 75.0 +1 75.0 75.0 75.0
|
||||
* 0 0.0 12.5 25.0 0 6.25 8.33 12.5
|
||||
* -1 8.33 4.17 0.0 -1 6.25 8.33 12.5
|
||||
* -2 8.33 4.17 0.0 -2 6.25 8.33 0.0
|
||||
* -3 8.33 4.17 0.0 -3 6.25 0.0 0.0
|
||||
* Biased against law and towards chaos. (The chance to be sent
|
||||
* down multiple levels when attempting to go up are significantly
|
||||
* less than the corresponding comment in older versions indicated
|
||||
* due to overlooking the effect of the call to assign_rnd_lvl().)
|
||||
*
|
||||
* Odds for making it to the next level up, or of being sent down:
|
||||
* "up" L N C
|
||||
* +1 75.0 75.0 75.0
|
||||
* 0 6.25 8.33 12.5
|
||||
* -1 11.46 12.50 12.5
|
||||
* -2 5.21 4.17 0.0
|
||||
* -3 2.08 0.0 0.0
|
||||
*/
|
||||
if (Inhell && up && u.uhave.amulet && !newdungeon && !portal &&
|
||||
(dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz)-3)) {
|
||||
|
||||
86
src/files.c
86
src/files.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 files.c $NHDT-Date: 1426544796 2015/03/16 22:26:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.134 $ */
|
||||
/* NetHack 3.5 files.c $NHDT-Date: 1426969026 2015/03/21 20:17:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.137 $ */
|
||||
/* NetHack 3.5 files.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.124 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -362,7 +362,9 @@ char *reasonbuf; /* reasonbuf must be at least BUFSZ, supplied by caller */
|
||||
#if defined(NOCWD_ASSUMPTIONS)
|
||||
for (prefcnt = 1; prefcnt < PREFIX_COUNT; prefcnt++) {
|
||||
/* don't test writing to configdir or datadir; they're readonly */
|
||||
if (prefcnt == CONFIGPREFIX || prefcnt == DATAPREFIX) continue;
|
||||
if (prefcnt == SYSCONFPREFIX ||
|
||||
prefcnt == CONFIGPREFIX ||
|
||||
prefcnt == DATAPREFIX) continue;
|
||||
filename = fqname("validate", prefcnt, 3);
|
||||
if ((fp = fopen(filename, "w"))) {
|
||||
fclose(fp);
|
||||
@@ -1811,6 +1813,8 @@ const char *configfile =
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* used for messaging */
|
||||
char lastconfigfile[BUFSZ];
|
||||
|
||||
#ifdef MSDOS
|
||||
/* conflict with speed-dial under windows
|
||||
@@ -1857,8 +1861,15 @@ int src;
|
||||
/* fall through to standard names */
|
||||
} else
|
||||
#endif
|
||||
if ((fp = fopenp(filename, "r")) != (FILE *)0) {
|
||||
configfile = filename;
|
||||
#ifdef PREFIXES_IN_USE
|
||||
if (src == SET_IN_SYS) {
|
||||
(void) strncpy(lastconfigfile,
|
||||
fqname(filename, SYSCONFPREFIX, 0), BUFSZ-1);
|
||||
} else
|
||||
#endif
|
||||
(void) strncpy(lastconfigfile, filename, BUFSZ-1);
|
||||
lastconfigfile[BUFSZ-1] = '\0';
|
||||
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) {
|
||||
return(fp);
|
||||
#if defined(UNIX) || defined(VMS)
|
||||
} else {
|
||||
@@ -1872,24 +1883,32 @@ int src;
|
||||
}
|
||||
|
||||
#if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32)
|
||||
if ((fp = fopenp(fqname(configfile, CONFIGPREFIX, 0), "r"))
|
||||
!= (FILE *)0)
|
||||
(void) strncpy(lastconfigfile,
|
||||
fqname(configfile, CONFIGPREFIX, 0), BUFSZ-1);
|
||||
lastconfigfile[BUFSZ-1] = '\0';
|
||||
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) {
|
||||
return(fp);
|
||||
}
|
||||
# ifdef MSDOS
|
||||
else if ((fp = fopenp(fqname(backward_compat_configfile,
|
||||
CONFIGPREFIX, 0), "r")) != (FILE *)0)
|
||||
(void) strncpy(lastconfigfile,
|
||||
fqname(backward_compat_configfile, CONFIGPREFIX, 0),
|
||||
BUFSZ-1);
|
||||
lastconfigfile[BUFSZ-1] = '\0';
|
||||
else if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0)
|
||||
return(fp);
|
||||
# endif
|
||||
#else
|
||||
/* constructed full path names don't need fqname() */
|
||||
# ifdef VMS
|
||||
if ((fp = fopenp(fqname("nethackini", CONFIGPREFIX, 0), "r"))
|
||||
!= (FILE *)0) {
|
||||
configfile = "nethackini";
|
||||
(void) strncpy(lastconfigfile, fqname("nethackini", CONFIGPREFIX, 0),
|
||||
BUFSZ-1);
|
||||
lastconfigfile[BUFSZ-1] = '\0';
|
||||
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) {
|
||||
return(fp);
|
||||
}
|
||||
if ((fp = fopenp("sys$login:nethack.ini", "r")) != (FILE *)0) {
|
||||
configfile = "nethack.ini";
|
||||
(void) strncpy(lastconfigfile,"sys$login:nethack.ini", BUFSZ-1);
|
||||
lastconfigfile[BUFSZ-1] = '\0';
|
||||
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) {
|
||||
return(fp);
|
||||
}
|
||||
|
||||
@@ -1898,6 +1917,9 @@ int src;
|
||||
Strcpy(tmp_config, "NetHack.cnf");
|
||||
else
|
||||
Sprintf(tmp_config, "%s%s", envp, "NetHack.cnf");
|
||||
|
||||
(void) strncpy(lastconfigfile, tmp_config, BUFSZ-1);
|
||||
lastconfigfile[BUFSZ-1] = '\0';
|
||||
if ((fp = fopenp(tmp_config, "r")) != (FILE *)0)
|
||||
return(fp);
|
||||
# else /* should be only UNIX left */
|
||||
@@ -1906,18 +1928,25 @@ int src;
|
||||
Strcpy(tmp_config, ".nethackrc");
|
||||
else
|
||||
Sprintf(tmp_config, "%s/%s", envp, ".nethackrc");
|
||||
if ((fp = fopenp(tmp_config, "r")) != (FILE *)0)
|
||||
|
||||
(void) strncpy(lastconfigfile, tmp_config, BUFSZ-1);
|
||||
lastconfigfile[BUFSZ-1] = '\0';
|
||||
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0)
|
||||
return(fp);
|
||||
# if defined(__APPLE__)
|
||||
/* try an alternative */
|
||||
if (envp) {
|
||||
Sprintf(tmp_config, "%s/%s", envp,
|
||||
"Library/Preferences/NetHack Defaults");
|
||||
if ((fp = fopenp(tmp_config, "r")) != (FILE *)0)
|
||||
(void) strncpy(lastconfigfile, tmp_config, BUFSZ-1);
|
||||
lastconfigfile[BUFSZ-1] = '\0';
|
||||
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0)
|
||||
return(fp);
|
||||
Sprintf(tmp_config, "%s/%s", envp,
|
||||
"Library/Preferences/NetHack Defaults.txt");
|
||||
if ((fp = fopenp(tmp_config, "r")) != (FILE *)0)
|
||||
(void) strncpy(lastconfigfile, tmp_config, BUFSZ-1);
|
||||
lastconfigfile[BUFSZ-1] = '\0';
|
||||
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0)
|
||||
return(fp);
|
||||
}
|
||||
# endif
|
||||
@@ -1932,7 +1961,7 @@ int src;
|
||||
# endif
|
||||
details = "";
|
||||
raw_printf("Couldn't open default config file %s %s(%d).",
|
||||
tmp_config, details, errno);
|
||||
lastconfigfile, details, errno);
|
||||
wait_synch();
|
||||
}
|
||||
# endif /* Unix */
|
||||
@@ -3199,6 +3228,29 @@ int ifd, ofd;
|
||||
/* ---------- END INTERNAL RECOVER ----------- */
|
||||
#endif /*SELF_RECOVER*/
|
||||
|
||||
/* ---------- OTHER ----------- */
|
||||
|
||||
#ifdef SYSCF
|
||||
# ifdef SYSCF_FILE
|
||||
void
|
||||
assure_syscf_file() {
|
||||
/* All we really care about is the end result - can we read the file?
|
||||
* So just check that directly. */
|
||||
int fd;
|
||||
fd = open(SYSCF_FILE, O_RDONLY);
|
||||
if(fd >= 0){
|
||||
/* readable */
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
raw_printf("Unable to open SYSCF_FILE.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
# endif /* SYSCF_FILE */
|
||||
#endif /* SYSCF */
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
/* used by debugpline() to decide whether to issue a message
|
||||
from a partiular source file; caller passes __FILE__ and we check
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 objnam.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 objnam.c $NHDT-Date: 1426977394 2015/03/21 22:36:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.108 $ */
|
||||
/* NetHack 3.5 objnam.c $Date: 2011/10/27 02:24:54 $ $Revision: 1.101 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1694,7 +1694,7 @@ static struct sing_plur one_off[] = {
|
||||
static const char *const as_is[] = {
|
||||
/* makesingular() leaves these plural due to how they're used */
|
||||
"boots", "shoes",
|
||||
"gloves", "lenses", "scales",
|
||||
"gloves", "lenses", "scales", "eyes",
|
||||
"gauntlets",
|
||||
"iron bars",
|
||||
/* both singular and plural are spelled the same */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 options.c $NHDT-Date: 1425083082 2015/02/28 00:24:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.158 $ */
|
||||
/* NetHack 3.5 options.c $NHDT-Date: 1427035440 2015/03/22 14:44:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.163 $ */
|
||||
/* NetHack 3.5 options.c $Date: 2012/04/09 02:56:30 $ $Revision: 1.153 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -798,10 +798,10 @@ rejectoption(optname)
|
||||
const char *optname;
|
||||
{
|
||||
#ifdef MICRO
|
||||
pline("\"%s\" settable only from %s.", optname, configfile);
|
||||
pline("\"%s\" settable only from %s.", optname, lastconfigfile);
|
||||
#else
|
||||
pline("%s can be set only from NETHACKOPTIONS or %s.", optname,
|
||||
configfile);
|
||||
lastconfigfile);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ const char *opts;
|
||||
#endif
|
||||
|
||||
if(from_file)
|
||||
raw_printf("Bad syntax in OPTIONS in %s: %s.", configfile, opts);
|
||||
raw_printf("Bad syntax in OPTIONS in %s: %s.", lastconfigfile, opts);
|
||||
else
|
||||
raw_printf("Bad syntax in NETHACKOPTIONS: %s.", opts);
|
||||
|
||||
@@ -4070,7 +4070,7 @@ option_help()
|
||||
winid datawin;
|
||||
|
||||
datawin = create_nhwindow(NHW_TEXT);
|
||||
Sprintf(buf, "Set options as OPTIONS=<options> in %s", configfile);
|
||||
Sprintf(buf, "Set options as OPTIONS=<options> in %s", lastconfigfile);
|
||||
opt_intro[CONFIG_SLOT] = (const char *) buf;
|
||||
for (i = 0; opt_intro[i]; i++)
|
||||
putstr(datawin, 0, opt_intro[i]);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* NetHack 3.5 pcmain.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 pcmain.c $NHDT-Date: 1426966701 2015/03/21 19:38:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.51 $ */
|
||||
/* NetHack 3.5 pcmain.c $Date: 2012/01/20 03:41:31 $ $Revision: 1.48 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
/* main.c - MSDOS, OS/2, ST, Amiga, and NT NetHack */
|
||||
/* main.c - MSDOS, OS/2, ST, Amiga, and Windows NetHack */
|
||||
|
||||
#include "hack.h"
|
||||
#include "dlb.h"
|
||||
@@ -244,6 +244,9 @@ char *argv[];
|
||||
|
||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||
chdirx(hackdir,0);
|
||||
#endif
|
||||
#ifdef SYSCF
|
||||
initoptions();
|
||||
#endif
|
||||
prscore(argc, argv);
|
||||
nethack_exit(EXIT_SUCCESS);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 unixmain.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.5 unixmain.c $NHDT-Date: 1426966705 2015/03/21 19:38:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
|
||||
/* NetHack 3.5 unixmain.c $Date: 2012/01/27 20:15:31 $ $Revision: 1.42 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -648,20 +648,4 @@ get_unix_pw()
|
||||
return pw;
|
||||
}
|
||||
|
||||
#ifdef SYSCF_FILE
|
||||
void
|
||||
assure_syscf_file(){
|
||||
/* All we really care about is the end result - can we read the file?
|
||||
* So just check that directly. */
|
||||
int fd;
|
||||
fd = open(SYSCF_FILE, O_RDONLY);
|
||||
if(fd >= 0){
|
||||
/* readable */
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
raw_printf("Unable to open SYSCF_FILE.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
/*unixmain.c*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# NetHack 3.5 Makefile.msc $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
# NetHack 3.5 Makefile.msc $NHDT-Date: 1426967393 2015/03/21 19:49:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.72 $ */
|
||||
# Copyright (c) NetHack PC Development Team 1993-2015
|
||||
#
|
||||
#==============================================================================
|
||||
@@ -79,6 +79,13 @@ TARGET_CPU=x86
|
||||
|
||||
GAMEDIR = ..\binary # Game directory
|
||||
|
||||
#
|
||||
#---------------------------------------------------------------
|
||||
# 4. Do you want debug information in the executable?
|
||||
#
|
||||
|
||||
DEBUGINFO = Y
|
||||
|
||||
# This marks the end of the BUILD DECISIONS section.
|
||||
#==============================================================================
|
||||
#
|
||||
@@ -111,7 +118,7 @@ DOC = ..\doc # NetHack documentation files
|
||||
UTIL = ..\util # Utility source
|
||||
SRC = ..\src # Main source
|
||||
SSYS = ..\sys\share # Shared system files
|
||||
NTSYS = ..\sys\winnt # NT Win32 specific files
|
||||
MSWSYS= ..\sys\winnt # mswin specific files
|
||||
TTY = ..\win\tty # window port files (tty)
|
||||
WIN32 = ..\win\win32 # window port files (Win32)
|
||||
WSHR = ..\win\share # Tile support files
|
||||
@@ -144,7 +151,7 @@ TARGET_CPU=x86
|
||||
# -Zd - generate only public symbols and line numbers for debugging
|
||||
# -GS - enable security checks
|
||||
#
|
||||
ccommon=-c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -c
|
||||
ccommon=-c $(CDBFLAG) -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -c
|
||||
lflags=/INCREMENTAL:NO /NOLOGO
|
||||
|
||||
!IF "$(TARGET_CPU)" == "x86"
|
||||
@@ -201,18 +208,6 @@ guilibs = $(winlibs)
|
||||
RANDOM = $(OBJ)\random.o
|
||||
#RANDOM =
|
||||
|
||||
#
|
||||
# Uncomment the next 2 lines _ONLY_ if you DO NOT want any
|
||||
# debug capability in the object files, or in the NetHack executable.
|
||||
# Comment them if you want debug capability.
|
||||
|
||||
#ldebug =
|
||||
#cdebug =
|
||||
|
||||
#
|
||||
# Compiler and Linker flags
|
||||
#
|
||||
|
||||
PRECOMPHEAD = N # set to Y if you want to use precomp. headers
|
||||
|
||||
#
|
||||
@@ -276,12 +271,19 @@ DLBFLG =
|
||||
#==========================================
|
||||
#==========================================
|
||||
|
||||
PDBFILE= /PDB:"$(O)$(GAME).PDB"
|
||||
MAPFILE= /MAP:"$(O)$(GAME).MAP"
|
||||
INCLDIR= /I..\include
|
||||
|
||||
ldebug=/DEBUG
|
||||
!IF "$(DEBUGINFO)" == "Y"
|
||||
CDBGFLAG=-Zi
|
||||
LDBGFLAG=/debug
|
||||
cdebug = -Zi -Od
|
||||
ldebug = /DEBUG
|
||||
!ELSE
|
||||
CDBGFLAG=
|
||||
LDBGFLAG=
|
||||
ldebug =
|
||||
cdebug =
|
||||
!ENDIF
|
||||
|
||||
!IF ("$(ldebug)" != "")
|
||||
!IF ("$(ldebug)" != "/RELEASE")
|
||||
@@ -365,10 +367,10 @@ DLB =
|
||||
# Rules for files in sys\winnt
|
||||
#==========================================
|
||||
|
||||
{$(NTSYS)}.c{$(OBJ)}.o:
|
||||
{$(MSWSYS)}.c{$(OBJ)}.o:
|
||||
@$(CC) $(cflagsUtil) -Fo$@ $<
|
||||
|
||||
{$(NTSYS)}.h{$(INCL)}.h:
|
||||
{$(MSWSYS)}.h{$(INCL)}.h:
|
||||
@copy $< $@
|
||||
|
||||
#==========================================
|
||||
@@ -413,7 +415,7 @@ DLB =
|
||||
# referenced later on in the Makefile.
|
||||
#
|
||||
|
||||
DEFFILE = $(NTSYS)\$(GAME).def
|
||||
DEFFILE = $(MSWSYS)\$(GAME).def
|
||||
|
||||
#
|
||||
# Shorten up the location for some files
|
||||
@@ -599,15 +601,16 @@ $(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \
|
||||
copy $(DAT)\*.lev $(GAMEDIR)
|
||||
if exist $(GAMEDIR)\makefile del $(GAMEDIR)\makefile
|
||||
! ENDIF
|
||||
if not exist $(GAMEDIR)\sysconf copy $(MSWSYS)\sysconf $(GAMEDIR)
|
||||
if exist $(DAT)\symbols copy $(DAT)\symbols $(GAMEDIR)
|
||||
if exist $(DOC)\guidebook.txt copy $(DOC)\guidebook.txt $(GAMEDIR)\Guidebook.txt
|
||||
if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt
|
||||
@if exist $(O)$(GAME).PDB copy $(O)$(GAME).pdb $(GAMEDIR)\$(GAME).pdb
|
||||
@if exist $(GAMEDIR)\$(GAME).PDB echo NOTE: You may want to remove $(GAMEDIR)\$(GAME).pdb to conserve space
|
||||
-copy $(NTSYS)\defaults.nh $(GAMEDIR)\defaults.nh
|
||||
-copy $(MSWSYS)\defaults.nh $(GAMEDIR)\defaults.nh
|
||||
echo install done > $@
|
||||
|
||||
# copy $(NTSYS)\winnt.hlp $(GAMEDIR)
|
||||
# copy $(MSWSYS)\winnt.hlp $(GAMEDIR)
|
||||
|
||||
recover: $(U)recover.exe
|
||||
if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR)
|
||||
@@ -666,8 +669,8 @@ $(NHRES): $(TILEBMP16) $(WIN32)\winhack.rc $(WIN32)\mnsel.bmp \
|
||||
$(WIN32)\splash.bmp
|
||||
@$(rc) -r -fo$@ -i$(WIN32) -dNDEBUG $(WIN32)\winhack.rc
|
||||
!ELSE
|
||||
$(NHRES): $(NTSYS)\console.rc $(NTSYS)\NetHack.ico
|
||||
@$(rc) -r -fo$@ -i$(NTSYS) -dNDEBUG $(NTSYS)\console.rc
|
||||
$(NHRES): $(MSWSYS)\console.rc $(MSWSYS)\NetHack.ico
|
||||
@$(rc) -r -fo$@ -i$(MSWSYS) -dNDEBUG $(MSWSYS)\console.rc
|
||||
!ENDIF
|
||||
|
||||
#==========================================
|
||||
@@ -838,12 +841,12 @@ $(U)uudecode.exe: $(O)uudecode.o
|
||||
$(O)uudecode.o: $(SSYS)\uudecode.c
|
||||
@$(CC) $(cflagsUtil) /D_CRT_SECURE_NO_DEPRECATE -Fo$@ $(SSYS)\uudecode.c
|
||||
|
||||
$(NTSYS)\NetHack.ico : $(U)uudecode.exe $(NTSYS)\nhico.uu
|
||||
chdir $(NTSYS)
|
||||
$(MSWSYS)\NetHack.ico : $(U)uudecode.exe $(MSWSYS)\nhico.uu
|
||||
chdir $(MSWSYS)
|
||||
..\..\util\uudecode.exe nhico.uu
|
||||
chdir ..\..\src
|
||||
|
||||
$(WIN32)\NetHack.ico : $(U)uudecode.exe $(NTSYS)\nhico.uu
|
||||
$(WIN32)\NetHack.ico : $(U)uudecode.exe $(MSWSYS)\nhico.uu
|
||||
chdir $(WIN32)
|
||||
..\..\util\uudecode.exe ../../sys/winnt/nhico.uu
|
||||
chdir ..\..\src
|
||||
@@ -978,8 +981,8 @@ envchk:
|
||||
# Header files NOT distributed in $(INCL)
|
||||
#===========================================
|
||||
|
||||
$(INCL)\win32api.h: $(NTSYS)\win32api.h
|
||||
copy $(NTSYS)\win32api.h $@
|
||||
$(INCL)\win32api.h: $(MSWSYS)\win32api.h
|
||||
copy $(MSWSYS)\win32api.h $@
|
||||
|
||||
|
||||
#==========================================
|
||||
@@ -1000,8 +1003,8 @@ $(O)dlb.o: $(O)dlb_main.o $(O)alloc.o $(O)panic.o $(INCL)\dlb.h
|
||||
$(O)dlb_main.o: $(UTIL)\dlb_main.c $(INCL)\config.h $(INCL)\dlb.h
|
||||
@$(CC) $(cflagsUtil) /Fo$@ $(UTIL)\dlb_main.c
|
||||
|
||||
$(DAT)\porthelp: $(NTSYS)\porthelp
|
||||
@copy $(NTSYS)\porthelp $@ >nul
|
||||
$(DAT)\porthelp: $(MSWSYS)\porthelp
|
||||
@copy $(MSWSYS)\porthelp $@ >nul
|
||||
|
||||
nhdat: $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \
|
||||
$(DAT)\quest.dat $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp \
|
||||
@@ -1296,14 +1299,14 @@ $(DAT)\dungeon: $(O)utility.tag $(DAT)\dungeon.def
|
||||
# NT dependencies
|
||||
#
|
||||
|
||||
$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nttty.c
|
||||
@$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(NTSYS)\nttty.c
|
||||
$(O)nhkeys.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nhkeys.c
|
||||
@$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(NTSYS)\nhkeys.c
|
||||
$(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(NTSYS)\winnt.c
|
||||
@$(CC) $(cflagsUtil) -Fo$@ $(NTSYS)\winnt.c
|
||||
$(O)ntsound.o: $(HACK_H) $(NTSYS)\ntsound.c
|
||||
@$(CC) $(cflagsUtil) -Fo$@ $(NTSYS)\ntsound.c
|
||||
$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(MSWSYS)\nttty.c
|
||||
@$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(MSWSYS)\nttty.c
|
||||
$(O)nhkeys.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(MSWSYS)\nhkeys.c
|
||||
@$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(MSWSYS)\nhkeys.c
|
||||
$(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(MSWSYS)\winnt.c
|
||||
@$(CC) $(cflagsUtil) -Fo$@ $(MSWSYS)\winnt.c
|
||||
$(O)ntsound.o: $(HACK_H) $(MSWSYS)\ntsound.c
|
||||
@$(CC) $(cflagsUtil) -Fo$@ $(MSWSYS)\ntsound.c
|
||||
|
||||
#
|
||||
# util dependencies
|
||||
|
||||
78
sys/winnt/sysconf
Normal file
78
sys/winnt/sysconf
Normal file
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# NetHack 3.5 sysconf $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$
|
||||
# NetHack 3.5 sysconf $Date: 2012/01/27 20:15:31 $ $Revision: 1.6 $
|
||||
#
|
||||
# Sample sysconf file.
|
||||
# The sysconf file is only used if NetHack is compiled with SYSCF defined.
|
||||
# This file uses the same syntax as nethack.cf.
|
||||
|
||||
# Which users can use WIZARD (debugging) mode (the -D flag).
|
||||
# A value of * allows anyone to enter debugging mode.
|
||||
WIZARDS=*
|
||||
|
||||
# Users allowed to use the ! (shell escape) command or to suspend the game.
|
||||
# Uses the same syntax as the WIZARDS option above.
|
||||
#SHELLERS=
|
||||
|
||||
# Show debugging information originating from these source files.
|
||||
# Use '*' for all, or list source files separated by spaces.
|
||||
# Only available if game has been compiled with DEBUG.
|
||||
#DEBUGFILES=*
|
||||
|
||||
# Limit the number of simultaneous games (see also nethack.sh).
|
||||
#MAXPLAYERS=10
|
||||
|
||||
# If not null, added to string "To get local support, " in the support
|
||||
# information help.
|
||||
#SUPPORT=call Izchak at extension 42.
|
||||
|
||||
# Uncomment the next line to disable the SEDUCE option.
|
||||
#SEDUCE=0
|
||||
|
||||
# Record (high score) file options.
|
||||
# CAUTION: changing these after people have started playing games can
|
||||
# lead to lost high scores!
|
||||
# Maximum entries for one person.
|
||||
#PERSMAX=10
|
||||
# Maximum entries in the record file.
|
||||
#ENTRYMAX=100
|
||||
# Minimum points to get an entry.
|
||||
#POINTSMIN=1
|
||||
# Determine identity of "person" in the score file with name (0) or
|
||||
# numeric (1) user id.
|
||||
#PERS_IS_UID=1
|
||||
|
||||
# Maximum number of score file entries to use for random statue names
|
||||
#MAX_STATUENAME_RANK=10
|
||||
|
||||
# *** LOCATIONS ***
|
||||
# IMPORTANT: If you change any of these locations, the directories they
|
||||
# point at must exist. NetHack will not create them for you.
|
||||
#
|
||||
# HACKDIR is the default location for everything.
|
||||
# Note: On Windows HACKDIR defaults to the location
|
||||
# of the NetHack.exe or NetHackw.exe file so
|
||||
# setting HACKDIR below to override that is
|
||||
# not usually necessary or recommended.
|
||||
#HACKDIR=c:\games\nethack
|
||||
#
|
||||
# The location that users can adjust their config file startup options
|
||||
#CONFIGDIR=c:\games\nethack
|
||||
#
|
||||
# The location that level files in progress are stored (default=HACKDIR, writeable)
|
||||
#LEVELDIR=c:\nethack\levels
|
||||
#
|
||||
# The location where saved games are kept (default=HACKDIR, writeable)
|
||||
#SAVEDIR=c:\nethack\save
|
||||
#
|
||||
# The location that bones files are kept (default=HACKDIR, writeable)
|
||||
#BONESDIR=c:\nethack\save
|
||||
#
|
||||
# The location that file synchronization locks are stored (default=HACKDIR, writeable)
|
||||
#LOCKDIR=c:\nethack\levels
|
||||
#
|
||||
# The location that a record of game aborts and self-diagnosed game problems
|
||||
# is kept (default=HACKDIR, writeable)
|
||||
#TROUBLEDIR=c:\nethack\trouble
|
||||
|
||||
|
||||
Reference in New Issue
Block a user