Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-11-25 15:49:18 -05:00
12 changed files with 202 additions and 98 deletions

View File

@@ -220,6 +220,8 @@ end of game while carrying Schroedinger's Box would reveal cat-or-corpse
for inventory disclosure or put that info into dumplog, but not both
attempting to untrap an adjacent trap while on the edge of--not in--a pit
failed due to not being able to reach the floor
magic trap's deafening roar effect wasn't waking nearby monsters
scattering of objects might leave source location with wrong thing displayed
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
@@ -229,6 +231,8 @@ setting the inverse attribute for gold had the space before "$:"
getting highlighted along with the gold field
sortloot segfaulted when filtering a subset of items (seen with 'A' command)
orctown: prevent Bad fruit #0 and some minor tuning
orctown: orcs beyond the mines were being given any left-over booty and named
as part of the same marauding gang operating within the mines
make long extended commands list be more navigable
simplify #wizidentify; don't rely on having bold menu entries
ensure tmp_at() structures are initialized for all code paths when swallowed

View File

@@ -431,7 +431,7 @@ E struct obj *FDECL(realloc_obj,
(struct obj *, int, genericptr_t, int, const char *));
E char *FDECL(coyotename, (struct monst *, char *));
E char *FDECL(rndorcname, (char *));
E struct monst *FDECL(christen_orc, (struct monst *, char *));
E struct monst *FDECL(christen_orc, (struct monst *, char *, char *));
E const char *FDECL(noveltitle, (int *));
E const char *FDECL(lookup_novel, (const char *, int *));

View File

@@ -2088,18 +2088,28 @@ char *s;
}
struct monst *
christen_orc(mtmp, gang)
christen_orc(mtmp, gang, other)
struct monst *mtmp;
char *gang;
char *gang, *other;
{
int sz = 0;
char buf[BUFSZ], buf2[BUFSZ], *orcname;
orcname = rndorcname(buf2);
sz = (int) (strlen(gang) + strlen(orcname) + sizeof " of " - sizeof "");
if (gang && orcname && sz < BUFSZ) {
Sprintf(buf, "%s of %s", upstart(orcname), upstart(gang));
mtmp = christen_monst(mtmp, buf);
sz = (int) ((gang ? strlen(gang) : other ? strlen(other) : 0)
+ strlen(orcname) + sizeof " of " - sizeof "");
if (sz < BUFSZ) {
boolean nameit = FALSE;
if (gang && orcname) {
Sprintf(buf, "%s of %s", upstart(orcname), upstart(gang));
nameit = TRUE;
} else if (other && orcname) {
Sprintf(buf, "%s%s", upstart(orcname), other);
nameit = TRUE;
}
if (nameit)
mtmp = christen_monst(mtmp, buf);
}
return mtmp;
}

View File

@@ -1680,7 +1680,8 @@ unsigned long deliverflags;
{
struct obj *otmp, *otmp2;
int where, maxobj = 1;
boolean at_crime_scene = In_mines(&u.uz);
if ((deliverflags & DF_RANDOM) && cnt > 1)
maxobj = rnd(cnt);
else if (deliverflags & DF_ALL)
@@ -1702,8 +1703,12 @@ unsigned long deliverflags;
/* special treatment for orcs and their kind */
if ((otmp->corpsenm & M2_ORC) != 0 && has_oname(otmp)) {
if (!has_mname(mtmp))
mtmp = christen_orc(mtmp, ONAME(otmp));
if (!has_mname(mtmp)) {
if (at_crime_scene || (!at_crime_scene && !rn2(2)))
mtmp = christen_orc(mtmp,
at_crime_scene ? ONAME(otmp) : (char *) 0,
" the Fence"); /* bought the stolen goods */
}
free_oname(otmp);
}
otmp->corpsenm = 0;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 explode.c $NHDT-Date: 1522454717 2018/03/31 00:05:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.56 $ */
/* NetHack 3.6 explode.c $NHDT-Date: 1543101719 2018/11/24 23:21:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -616,6 +616,10 @@ struct obj *obj; /* only scatter this obj */
struct scatter_chain *schain = (struct scatter_chain *) 0;
long total = 0L;
if (individual_object && (obj->ox != sx || obj->oy != sy))
impossible("scattered object <%d,%d> not at scatter site <%d,%d>",
obj->ox, obj->oy, sx, sy);
while ((otmp = (individual_object ? obj : level.objects[sx][sy])) != 0) {
if (otmp->quan > 1L) {
qtmp = otmp->quan - 1L;
@@ -759,7 +763,7 @@ struct obj *obj; /* only scatter this obj */
free((genericptr_t) stmp);
newsym(x, y);
}
newsym(sx, sy);
return total;
}

View File

@@ -799,7 +799,7 @@ stolen_booty(VOID_ARGS)
* member of the main orc horde.
*/
if (mtmp->data != &mons[PM_ORC_CAPTAIN])
mtmp = christen_orc(mtmp, upstart(gang));
mtmp = christen_orc(mtmp, upstart(gang), "");
}
}
/* Lastly, ensure there's several more orcs from the gang along the way.

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1543052701 2018/11/24 09:45:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.270 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1543100460 2018/11/24 23:01:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.271 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2827,40 +2827,34 @@ boolean via_attack;
void
wake_nearby()
{
register struct monst *mtmp;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
continue;
if (distu(mtmp->mx, mtmp->my) < u.ulevel * 20) {
mtmp->msleeping = 0;
if (!unique_corpstat(mtmp->data))
mtmp->mstrategy &= ~STRAT_WAITMASK;
if (mtmp->mtame) {
if (!mtmp->isminion)
EDOG(mtmp)->whistletime = moves;
/* Clear mtrack. This is to fix up a pet who is
stuck "fleeing" its master. */
memset(mtmp->mtrack, 0, sizeof(mtmp->mtrack));
}
}
}
wake_nearto(u.ux, u.uy, u.ulevel * 20);
}
/* Wake up monsters near some particular location. */
void
wake_nearto(x, y, distance)
register int x, y, distance;
int x, y, distance;
{
register struct monst *mtmp;
struct monst *mtmp;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
continue;
if (distance == 0 || dist2(mtmp->mx, mtmp->my, x, y) < distance) {
mtmp->msleeping = 0;
if (!unique_corpstat(mtmp->data))
mtmp->mstrategy &= ~STRAT_WAITMASK;
/* sleep for N turns uses mtmp->mfrozen, but so does paralysis
so we leave mfrozen monsters alone */
mtmp->msleeping = 0; /* wake indeterminate sleep */
if (!(mtmp->data->geno & G_UNIQ))
mtmp->mstrategy &= ~STRAT_WAITMASK; /* wake 'meditation' */
if (context.mon_moving)
continue;
if (mtmp->mtame) {
if (!mtmp->isminion)
EDOG(mtmp)->whistletime = moves;
/* Clear mtrack. This is to fix up a pet who is
stuck "fleeing" its master. */
memset(mtmp->mtrack, 0, sizeof mtmp->mtrack);
}
}
}
}

View File

@@ -1340,64 +1340,88 @@ boolean do_mons; /* True => monsters, False => objects */
destroy_nhwindow(win);
}
static const char *suptext1[] = {
"%s is a member of a marauding horde of orcs",
"rumored to have brutally attacked and plundered",
"the ordinarily sheltered town that is located ",
"deep within The Gnomish Mines.",
"",
"The members of that vicious horde proudly and ",
"defiantly acclaim their allegiance to their",
"leader %s in their names.",
(char *) 0,
};
static const char *suptext2[] = {
"%s is a nefarious orc who is known to acquire",
"property from thieves and sell it off for profit",
"or gain. The perpetrator was last seen hanging",
"around the stairs leading to the Gnomish Mines.",
(char *) 0,
};
void
do_supplemental_info(name, pm, without_asking)
char *name;
struct permonst *pm;
boolean without_asking;
{
const char **textp;
winid datawin = WIN_ERR;
char *entrytext = name, *bp;
char *entrytext = name, *bp = (char *) 0, *bp2 = (char *) 0;
char question[QBUFSZ];
boolean yes_to_moreinfo = FALSE;
boolean is_marauder = (name && pm && is_orc(pm));
/*
* Provide some info on some specific things
* meant to support in-game mythology, and not
* available from data.base or other sources.
*/
if (name && pm && is_orc(pm) && (strlen(name) < (BUFSZ - 1))
&& (bp = strstri(name, " of ")) != 0) {
if (is_marauder && (strlen(name) < (BUFSZ - 1))) {
char fullname[BUFSZ];
Strcpy(fullname, name);
if (!without_asking) {
Strcpy(question, "More info about \"");
/* +2 => length of "\"?" */
copynchars(eos(question), entrytext,
(int) (sizeof question - 1 - (strlen(question) + 2)));
Strcat(question, "\"?");
if (yn(question) == 'y')
yes_to_moreinfo = TRUE;
}
if (yes_to_moreinfo) {
int i, subs = 0;
char *gang = bp + 4;
static const char *text[] = {
"%s is a member of a marauding horde of orcs",
"rumored to have brutally attacked and plundered the ordinarily",
"sheltered town that is located deep within The Gnomish Mines.",
"",
"The members of that vicious horde proudly and defiantly acclaim",
"their allegiance to their leader %s in their names.",
};
bp = strstri(name, " of ");
bp2 = strstri(name, " the Fence");
*bp = '\0';
datawin = create_nhwindow(NHW_MENU);
for (i = 0; i < SIZE(text); i++) {
char buf[BUFSZ];
const char *txt;
if (strstri(text[i], "%s") != 0) {
Sprintf(buf, text[i],
subs++ ? gang : fullname);
txt = buf;
} else
txt = text[i];
putstr(datawin, 0, txt);
if (bp || bp2) {
Strcpy(fullname, name);
if (!without_asking) {
Strcpy(question, "More info about \"");
/* +2 => length of "\"?" */
copynchars(eos(question), entrytext,
(int) (sizeof question - 1 - (strlen(question) + 2)));
Strcat(question, "\"?");
if (yn(question) == 'y')
yes_to_moreinfo = TRUE;
}
if (yes_to_moreinfo) {
int i, subs = 0;
char *gang = (char *) 0;
if (bp) {
textp = suptext1;
gang = bp + 4;
*bp = '\0';
} else {
textp = suptext2;
gang = "";
}
datawin = create_nhwindow(NHW_MENU);
for (i = 0; textp[i]; i++) {
char buf[BUFSZ];
const char *txt;
if (strstri(textp[i], "%s") != 0) {
Sprintf(buf, textp[i], subs++ ? gang : fullname);
txt = buf;
} else
txt = textp[i];
putstr(datawin, 0, txt);
}
display_nhwindow(datawin, FALSE);
destroy_nhwindow(datawin), datawin = WIN_ERR;
}
display_nhwindow(datawin, FALSE);
destroy_nhwindow(datawin), datawin = WIN_ERR;
}
}
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 trap.c $NHDT-Date: 1542856572 2018/11/22 03:16:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.304 $ */
/* NetHack 3.6 trap.c $NHDT-Date: 1543100476 2018/11/24 23:01:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.311 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3164,7 +3164,7 @@ domagictrap()
if (fate < 10) {
/* Most of the time, it creates some monsters. */
register int cnt = rnd(4);
int cnt = rnd(4);
/* blindness effects */
if (!resists_blnd(&youmonst)) {
@@ -3189,6 +3189,9 @@ domagictrap()
}
while (cnt--)
(void) makemon((struct permonst *) 0, u.ux, u.uy, NO_MM_FLAGS);
/* roar: wake monsters in vicinity, after placing trap-created ones */
wake_nearto(u.ux, u.uy, 7 * 7);
/* [flash: should probably also hit nearby gremlins with light] */
} else
switch (fate) {
case 10:

View File

@@ -686,7 +686,8 @@ $(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \
if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt
@if exist $(GAMEDIR)\NetHack.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHack.PDB to conserve space
@if exist $(GAMEDIR)\NetHackW.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHackW.PDB to conserve space
-if not exist $(GAMEDIR)\defaults.nh copy $(MSWSYS)\defaults.nh $(GAMEDIR)\defaults.nh
$(U)makedefs -c
-if not exist $(GAMEDIR)\defaults.nh copy fixed_defaults.nh $(GAMEDIR)\defaults.nh
-if not exist $(GAMEDIR)\record. goto>$(GAMEDIR)\record.
echo install done > $@
@@ -1359,6 +1360,7 @@ clean:
if exist $(U)dgncomp.exe del $(U)dgncomp.exe
if exist $(SRC)\*.lnk del $(SRC)\*.lnk
if exist $(SRC)\*.map del $(SRC)\*.map
if exist $(SRC)\fixed_defaults.nh del $(SRC)\fixed_defaults.nh
if exist $(O)install.tag del $(O)install.tag
if exist $(O)console.res del $(O)console.res
if exist $(O)dgncomp.MAP del $(O)dgncomp.MAP

View File

@@ -111,6 +111,15 @@ static const char SCCS_Id[] UNUSED = "@(#)makedefs.c\t3.6\t2018/03/02";
#endif /* else !MAC */
#endif /* else !AMIGA */
#if !defined(STATUS_HILITES) && defined(WIN32)
#define FIX_SAMPLECONFIG
#endif
#ifdef WIN32
#define SAMPLE_CONFIGFILE "../sys/winnt/defaults.nh"
#define FIXED_CONFIGFILE "./fixed_defaults.nh"
#endif
static const char
*Dont_Edit_Code =
"/* This source file is generated by 'makedefs'. Do not edit. */\n",
@@ -162,6 +171,9 @@ void NDECL(do_questtxt);
void NDECL(do_rumors);
void NDECL(do_oracles);
void NDECL(do_vision);
#ifdef WIN32
void NDECL(do_fix_sampleconfig);
#endif
extern void NDECL(monst_init); /* monst.c */
extern void NDECL(objects_init); /* objects.c */
@@ -364,7 +376,12 @@ char *options;
case 'Z':
do_vision();
break;
#ifdef WIN32
case 'c':
case 'C':
do_fix_sampleconfig();
break;
#endif
default:
Fprintf(stderr, "Unknown option '%c'.\n", *options);
(void) fflush(stderr);
@@ -1471,6 +1488,45 @@ char *githash, *gitbranch;
return FALSE;
}
#ifdef WIN32
void
do_fix_sampleconfig()
{
FILE *scfp, *ofcfp;
char fixedline[600];
char *line;
if (!(scfp = fopen(SAMPLE_CONFIGFILE, RDTMODE))) {
return;
}
if (!(ofcfp = fopen(FIXED_CONFIGFILE, WRTMODE))) {
return;
}
/* read the sample config file */
while ((line = fgetline(scfp)) != 0) {
/* comment out the STATUS_HILITES related lines */
if (strlen(line) < (600 - 1)) {
if (strstr(line, "statushilites") || strstr(line, "hilite_status:")) {
#ifdef FIX_SAMPLECONFIG
fixedline[0] = '#';
Strcpy(&fixedline[1], line);
#else
Strcpy(fixedline, line);
#endif
fputs(fixedline, ofcfp);
} else {
fputs(line, ofcfp);
}
}
free(line);
}
Fclose(scfp);
Fclose(ofcfp);
return;
}
#endif /* WIN32 */
static int
case_insensitive_comp(s1, s2)
const char *s1;

View File

@@ -3612,26 +3612,10 @@ const char *fmt;
boolean enable;
{
genl_status_enablefield(fieldidx, nm, fmt, enable);
#ifdef STATUS_HILITES
/* force re-evaluation of last field on the row */
setlast = FALSE;
}
void
do_setlast()
{
int i, row, fld;
setlast = TRUE;
for (row = 0; row < 2; ++row)
for (i = MAX_PER_ROW - 1; i > 0; --i) {
fld = fieldorder[row][i];
if (fld == BL_FLUSH || !status_activefields[fld])
continue;
last_on_row[row] = fld;
break;
}
#endif
}
#ifdef STATUS_HILITES
@@ -3807,6 +3791,24 @@ unsigned long *colormasks;
return;
}
void
do_setlast()
{
int i, row, fld;
setlast = TRUE;
for (row = 0; row < 2; ++row)
for (i = MAX_PER_ROW - 1; i > 0; --i) {
fld = fieldorder[row][i];
if (fld == BL_FLUSH || !status_activefields[fld])
continue;
last_on_row[row] = fld;
break;
}
}
STATIC_OVL int
make_things_fit(force_update)
boolean force_update;