Merge branch 'NetHack-3.7' into paxed-lua-v2-merged

This commit is contained in:
nhmall
2019-11-11 14:33:31 -05:00
12 changed files with 210 additions and 153 deletions

View File

@@ -110,7 +110,13 @@ const char *materialnm[] = { "mysterious", "liquid", "wax", "organic",
/* Global windowing data, defined here for multi-window-system support */
NEARDATA winid WIN_MESSAGE, WIN_STATUS, WIN_MAP, WIN_INVEN;
#ifdef WIN32
boolean fqn_prefix_locked[PREFIX_COUNT] = { FALSE, FALSE, FALSE,
FALSE, FALSE, FALSE,
FALSE, FALSE, FALSE,
FALSE };
#endif
#ifdef PREFIXES_IN_USE
const char *fqn_prefix_names[PREFIX_COUNT] = {
"hackdir", "leveldir", "savedir", "bonesdir", "datadir",

View File

@@ -106,6 +106,10 @@ extern void FDECL(amii_set_text_font, (char *, int));
#ifndef WIN_CE
#define DeleteFile unlink
#endif
#ifdef WIN32
/*from windmain.c */
extern char *FDECL(translate_path_variables, (const char *, char *));
#endif
#endif
#ifdef MAC
@@ -299,6 +303,13 @@ const char *basenam;
int whichprefix UNUSED_if_not_PREFIXES_IN_USE;
int buffnum UNUSED_if_not_PREFIXES_IN_USE;
{
#ifdef PREFIXES_IN_USE
char *bufptr;
#endif
#ifdef WIN32
char tmpbuf[BUFSZ];
#endif
#ifndef PREFIXES_IN_USE
return basenam;
#else
@@ -310,15 +321,19 @@ int buffnum UNUSED_if_not_PREFIXES_IN_USE;
impossible("Invalid fqn_filename_buffer specified: %d", buffnum);
buffnum = 0;
}
if (strlen(g.fqn_prefix[whichprefix]) + strlen(basenam)
>= FQN_MAX_FILENAME) {
impossible("fqname too long: %s + %s", g.fqn_prefix[whichprefix],
basenam);
bufptr = g.fqn_prefix[whichprefix];
#ifdef WIN32
if (strchr(g.fqn_prefix[whichprefix], '%')
|| strchr(g.fqn_prefix[whichprefix], '~'))
bufptr = translate_path_variables(g.fqn_prefix[whichprefix], tmpbuf);
#endif
if (strlen(bufptr) + strlen(basenam) >= FQN_MAX_FILENAME) {
impossible("fqname too long: %s + %s", bufptr, basenam);
return basenam; /* XXX */
}
Strcpy(fqn_filename_buffer[buffnum], g.fqn_prefix[whichprefix]);
Strcpy(fqn_filename_buffer[buffnum], bufptr);
return strcat(fqn_filename_buffer[buffnum], basenam);
#endif
#endif /* !PREFIXES_IN_USE */
}
int
@@ -2390,6 +2405,10 @@ int prefixid;
if (!bufp)
return;
#ifdef WIN32
if (fqn_prefix_locked[prefixid])
return;
#endif
/* Backward compatibility, ignore trailing ;n */
if ((ptr = index(bufp, ';')) != 0)
*ptr = '\0';
@@ -4129,6 +4148,10 @@ assure_syscf_file()
{
int fd;
#ifdef WIN32
/* We are checking that the sysconf exists ... lock the path */
fqn_prefix_locked[SYSCONFPREFIX] = TRUE;
#endif
/*
* All we really care about is the end result - can we read the file?
* So just check that directly.

View File

@@ -2478,8 +2478,8 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
vis = FALSE; /* skip makeknown() below */
res = FALSE; /* failed to cure sliming */
} else {
m_useup(mon, obj); /* before explode() */
dmg = (2 * (rn1(3, 3) + 2 * bcsign(obj)) + 1) / 3;
m_useup(mon, obj); /* before explode() */
/* -11 => monster's fireball */
explode(mon->mx, mon->my, -11, dmg, SCROLL_CLASS,
/* by_you: override -11 for mon but not others */

View File

@@ -661,7 +661,7 @@ initoptions()
/* ... and _must_ parse correctly. */
if (!read_config_file(SYSCF_FILE, SET_IN_SYS)) {
if (config_error_done())
if (config_error_done() && !iflags.initoptions_noterminate)
nh_terminate(EXIT_FAILURE);
}
config_error_done();

View File

@@ -4435,7 +4435,9 @@ short exploding_wand_typ;
} else if (is_pool(x, y)) {
const char *msgtxt = (!Deaf)
? "You hear hissing gas." /* Deaf-aware */
: "That seemed remarkably uneventful.";
: (type >= 0)
? "That seemed remarkably uneventful."
: (const char *) 0;
if (lev->typ != POOL) { /* MOAT or DRAWBRIDGE_UP */
if (see_it)
@@ -4449,7 +4451,8 @@ short exploding_wand_typ;
if (see_it)
msgtxt = "The water evaporates.";
}
Norep("%s", msgtxt);
if (msgtxt)
Norep("%s", msgtxt);
if (lev->typ == ROOM)
newsym(x, y);
} else if (IS_FOUNTAIN(lev->typ)) {