Merge branch 'master' into nhmall-booktribute
Conflicts: sys/winnt/Makefile.msc
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user