Merge branch 'NetHack-3.6'

This commit is contained in:
nhmall
2019-05-20 15:50:17 -04:00
4 changed files with 98 additions and 29 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.8 $ $NHDT-Date: 1558248715 2019/05/19 06:51:55 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.10 $ $NHDT-Date: 1558355176 2019/05/20 12:26:16 $
This fixes36.3 file is here to capture information about updates in the 3.6.x This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however, lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -35,6 +35,10 @@ curses: if message window is only one line, cancelling some prompts with ESC
left the prompts visible on the message line instead of erasing them left the prompts visible on the message line instead of erasing them
curses: support EDIT_GETLIN (but like with tty, it's disabled by default) to curses: support EDIT_GETLIN (but like with tty, it's disabled by default) to
pre-load an earlier response as the default answer for some prompts pre-load an earlier response as the default answer for some prompts
tty: re-do one optimization used when status conditions have all been removed
and remove another that tried to check whether condition text to be
displayed next was the same as the existing value; sometimes new
status condition wouldn't be shown unless a screen redraw was forced
Windows: some startup error messages were not being delivered successfully Windows: some startup error messages were not being delivered successfully
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 wintty.h $NHDT-Date: 1553858470 2019/03/29 11:21:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.33 $ */ /* NetHack 3.6 wintty.h $NHDT-Date: 1558330405 2019/05/20 05:33:25 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.34 $ */
/* Copyright (c) David Cohrs, 1991,1992 */ /* Copyright (c) David Cohrs, 1991,1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -79,7 +79,7 @@ struct tty_status_fields {
boolean valid; boolean valid;
boolean dirty; boolean dirty;
boolean redraw; boolean redraw;
boolean _not_used; /* was 'last_in_row' */ boolean sanitycheck; /* was 'last_in_row' */
}; };
#endif #endif
+12 -8
View File
@@ -91,9 +91,13 @@ DEBUGINFO = Y
# #
#============================================================================== #==============================================================================
#
# The version of the game this Makefile was designed for
NETHACK_VERSION="3.6.3"
# Set the gamedir according to your preference. # A brief version for use in macros
# If not present prior to compilation it gets created. NHV=$(NETHACK_VERSION:.=)
NHV=$(NHV:"=)
# #
# Source directories. Makedefs hardcodes these, don't change them. # Source directories. Makedefs hardcodes these, don't change them.
@@ -549,7 +553,7 @@ lflagsBuild = $(lflags) $(conlibs) $(MACHINE)
LIBS= user32.lib winmm.lib $(ZLIB) $(CURSESLIB) LIBS= user32.lib winmm.lib $(ZLIB) $(CURSESLIB)
! IF ("$(USE_DLB)"=="Y") ! IF ("$(USE_DLB)"=="Y")
DLB = nhdat DLB = nhdat$(NHV)
! ELSE ! ELSE
DLB = DLB =
! ENDIF ! ENDIF
@@ -673,7 +677,7 @@ install: $(O)envchk.tag $(O)obj.tag $(O)utility.tag $(GAMEDIR)\NetHack.exe $(GAM
$(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \ $(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \
$(DAT)\oracles $(DAT)\quest.dat $(O)sp_lev.tag $(DLB) $(DAT)\oracles $(DAT)\quest.dat $(O)sp_lev.tag $(DLB)
! IF ("$(USE_DLB)"=="Y") ! IF ("$(USE_DLB)"=="Y")
copy nhdat* $(GAMEDIR) copy nhdat$(NHV) $(GAMEDIR)
copy $(DAT)\license $(GAMEDIR) copy $(DAT)\license $(GAMEDIR)
copy $(DAT)\opthelp $(GAMEDIR) copy $(DAT)\opthelp $(GAMEDIR)
! ELSE ! ELSE
@@ -1100,7 +1104,7 @@ $(O)envchk.tag: $(O)obj.tag
#========================================== #==========================================
#========================================== #==========================================
# DLB utility and nhdat file creation # DLB utility and nhdatNNN file creation
#========================================== #==========================================
$(U)dlb_main.exe: $(DLBOBJ) $(O)dlb.o $(U)dlb_main.exe: $(DLBOBJ) $(O)dlb.o
@@ -1121,7 +1125,7 @@ $(O)dlb_main.o: $(UTIL)\dlb_main.c $(INCL)\config.h $(INCL)\dlb.h
$(DAT)\porthelp: $(MSWSYS)\porthelp $(DAT)\porthelp: $(MSWSYS)\porthelp
@copy $(MSWSYS)\porthelp $@ >nul @copy $(MSWSYS)\porthelp $@ >nul
nhdat: $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \ nhdat$(NHV): $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \
$(DAT)\quest.dat $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp $(DAT)\keyhelp \ $(DAT)\quest.dat $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp $(DAT)\keyhelp \
$(DAT)\history $(DAT)\opthelp $(DAT)\wizhelp $(DAT)\dungeon $(DAT)\porthelp \ $(DAT)\history $(DAT)\opthelp $(DAT)\wizhelp $(DAT)\dungeon $(DAT)\porthelp \
$(DAT)\license $(DAT)\engrave $(DAT)\epitaph $(DAT)\bogusmon $(DAT)\tribute $(O)sp_lev.tag $(DAT)\license $(DAT)\engrave $(DAT)\epitaph $(DAT)\bogusmon $(DAT)\tribute $(O)sp_lev.tag
@@ -1281,7 +1285,7 @@ spotless: clean
if exist $(GAMEDIR)\nhraykey.dll del $(GAMEDIR)\nhraykey.dll if exist $(GAMEDIR)\nhraykey.dll del $(GAMEDIR)\nhraykey.dll
if exist $(GAMEDIR)\NetHack.exe del $(GAMEDIR)\NetHack.exe if exist $(GAMEDIR)\NetHack.exe del $(GAMEDIR)\NetHack.exe
if exist $(GAMEDIR)\NetHack.pdb del $(GAMEDIR)\NetHack.pdb if exist $(GAMEDIR)\NetHack.pdb del $(GAMEDIR)\NetHack.pdb
if exist $(GAMEDIR)\nhdat* del $(GAMEDIR)\nhdat* if exist $(GAMEDIR)\nhdat$(NHV) del $(GAMEDIR)\nhdat$(NHV)
! ENDIF ! ENDIF
if exist $(INCL)\date.h del $(INCL)\date.h if exist $(INCL)\date.h del $(INCL)\date.h
if exist $(INCL)\onames.h del $(INCL)\onames.h if exist $(INCL)\onames.h del $(INCL)\onames.h
@@ -1334,7 +1338,7 @@ spotless: clean
if exist $(DAT)\porthelp del $(DAT)\porthelp if exist $(DAT)\porthelp del $(DAT)\porthelp
if exist $(O)sp_lev.tag del $(O)sp_lev.tag if exist $(O)sp_lev.tag del $(O)sp_lev.tag
if exist $(SRC)\vis_tab.c del $(SRC)\vis_tab.c if exist $(SRC)\vis_tab.c del $(SRC)\vis_tab.c
if exist nhdat*. del nhdat*. if exist nhdat$(NHV). del nhdat$(NHV).
if exist $(O)obj.tag del $(O)obj.tag if exist $(O)obj.tag del $(O)obj.tag
if exist $(O)gamedir.tag del $(O)gamedir.tag if exist $(O)gamedir.tag del $(O)gamedir.tag
if exist $(O)nh*key.lib del $(O)nh*key.lib if exist $(O)nh*key.lib del $(O)nh*key.lib
+79 -18
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 wintty.c $NHDT-Date: 1557088734 2019/05/05 20:38:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.203 $ */ /* NetHack 3.6 wintty.c $NHDT-Date: 1558355176 2019/05/20 12:26:16 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.206 $ */
/* Copyright (c) David Cohrs, 1991 */ /* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -208,6 +208,9 @@ STATIC_DCL int NDECL(condition_size);
STATIC_DCL int FDECL(make_things_fit, (BOOLEAN_P)); STATIC_DCL int FDECL(make_things_fit, (BOOLEAN_P));
STATIC_DCL void FDECL(shrink_enc, (int)); STATIC_DCL void FDECL(shrink_enc, (int));
STATIC_DCL void FDECL(shrink_dlvl, (int)); STATIC_DCL void FDECL(shrink_dlvl, (int));
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
STATIC_DCL void NDECL(status_sanity_check);
#endif /* NH_DEVEL_STATUS */
#endif #endif
/* /*
@@ -3617,9 +3620,11 @@ char *posbar;
* *
* render_status * render_status
* *
* Goes through each of the two status row's fields and * Goes through each of the status row's fields and
* calls tty_putstatusfield() to place them on the display. * calls tty_putstatusfield() to place them on the display.
* ->tty_putstatusfield() * ->tty_putstatusfield()
* At the end of the for-loop, the NOW values get copied
* to BEFORE values.
* *
* tty_putstatusfield() * tty_putstatusfield()
* *
@@ -3746,6 +3751,7 @@ tty_status_init()
tty_status[NOW][i].valid = FALSE; tty_status[NOW][i].valid = FALSE;
tty_status[NOW][i].dirty = FALSE; tty_status[NOW][i].dirty = FALSE;
tty_status[NOW][i].redraw = FALSE; tty_status[NOW][i].redraw = FALSE;
tty_status[NOW][i].sanitycheck = FALSE;
tty_status[BEFORE][i] = tty_status[NOW][i]; tty_status[BEFORE][i] = tty_status[NOW][i];
} }
tty_condition_bits = 0L; tty_condition_bits = 0L;
@@ -3849,8 +3855,12 @@ unsigned long *colormasks;
reset_state = FORCE_RESET; reset_state = FORCE_RESET;
/*FALLTHRU*/ /*FALLTHRU*/
case BL_FLUSH: case BL_FLUSH:
if (make_things_fit(reset_state) || truncation_expected) if (make_things_fit(reset_state) || truncation_expected) {
render_status(); render_status();
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
status_sanity_check();
#endif
}
return; return;
case BL_CONDITION: case BL_CONDITION:
tty_status[NOW][fldidx].idx = fldidx; tty_status[NOW][fldidx].idx = fldidx;
@@ -3858,6 +3868,7 @@ unsigned long *colormasks;
tty_colormasks = colormasks; tty_colormasks = colormasks;
tty_status[NOW][fldidx].valid = TRUE; tty_status[NOW][fldidx].valid = TRUE;
tty_status[NOW][fldidx].dirty = TRUE; tty_status[NOW][fldidx].dirty = TRUE;
tty_status[NOW][fldidx].sanitycheck = TRUE;
truncation_expected = FALSE; truncation_expected = FALSE;
break; break;
case BL_GOLD: case BL_GOLD:
@@ -3885,6 +3896,7 @@ unsigned long *colormasks;
tty_status[NOW][fldidx].lth = strlen(status_vals[fldidx]); tty_status[NOW][fldidx].lth = strlen(status_vals[fldidx]);
tty_status[NOW][fldidx].valid = TRUE; tty_status[NOW][fldidx].valid = TRUE;
tty_status[NOW][fldidx].dirty = TRUE; tty_status[NOW][fldidx].dirty = TRUE;
tty_status[NOW][fldidx].sanitycheck = TRUE;
break; break;
} }
@@ -4055,10 +4067,10 @@ int sz[3];
* - Is the additional processing time for this worth it? * - Is the additional processing time for this worth it?
*/ */
if (do_field_opt if (do_field_opt
/* These color/attr checks aren't right for /* color/attr checks aren't right for 'condition'
'condition'; is it safe to assume that same text and neither is examining status_vals[BL_CONDITION]
means same highlighting for that field? If not, so skip same-contents optimization for conditions */
we'd end up redrawing conditions every time. */ && idx != BL_CONDITION
&& (tty_status[NOW][idx].color && (tty_status[NOW][idx].color
== tty_status[BEFORE][idx].color) == tty_status[BEFORE][idx].color)
&& (tty_status[NOW][idx].attr && (tty_status[NOW][idx].attr
@@ -4108,6 +4120,52 @@ int sz[3];
return valid; return valid;
} }
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
STATIC_OVL void
status_sanity_check(VOID_ARGS)
{
int i;
static boolean in_sanity_check = FALSE;
static const char *const idxtext[] = {
"BL_TITLE", "BL_STR", "BL_DX", "BL_CO", "BL_IN", "BL_WI", /* 0.. 5 */
"BL_CH","BL_ALIGN", "BL_SCORE", "BL_CAP", "BL_GOLD", /* 6.. 10 */
"BL_ENE", "BL_ENEMAX", "BL_XP", "BL_AC", "BL_HD", /* 11.. 15 */
"BL_TIME", "BL_HUNGER", "BL_HP", "BL_HPMAX", /* 16.. 19 */
"BL_LEVELDESC", "BL_EXP", "BL_CONDITION" /* 20.. 22 */
};
if (in_sanity_check)
return;
in_sanity_check = TRUE;
/*
* Make sure that every field made it down to the
* bottom of the render_status() for-loop.
*/
for (i = 0; i < MAXBLSTATS; ++i) {
if (tty_status[NOW][i].sanitycheck) {
char panicmsg[BUFSZ];
Sprintf(panicmsg, "failed on tty_status[NOW][%s].", idxtext[i]);
paniclog("status_sanity_check", panicmsg);
tty_status[NOW][i].sanitycheck = FALSE;
/*
* Attention developers: If you encounter the above
* message in paniclog, it almost certainly means that
* a recent code change has caused a failure to reach
* the bottom of render_status(), at least for the BL_
* field identified in the impossible() message.
*
* That could be because of the addition of a continue
* statement within the render_status() for-loop, or a
* premature return from render_status() before it finished
* its housekeeping chores.
*/
}
}
in_sanity_check = FALSE;
}
#endif /* NHDEVEL_STATUS */
/* /*
* This is what places a field on the tty display. * This is what places a field on the tty display.
*/ */
@@ -4330,8 +4388,8 @@ render_status(VOID_ARGS)
if (!status_activefields[idx]) if (!status_activefields[idx])
continue; continue;
x = tty_status[NOW][idx].x; x = tty_status[NOW][idx].x;
text = status_vals[idx]; text = status_vals[idx]; /* always "" for BL_CONDITION */
tlth = (int) tty_status[NOW][idx].lth; tlth = (int) tty_status[NOW][idx].lth; /* valid for BL_CONDITION */
if (tty_status[NOW][idx].redraw || !do_field_opt) { if (tty_status[NOW][idx].redraw || !do_field_opt) {
boolean hitpointbar = (idx == BL_TITLE boolean hitpointbar = (idx == BL_TITLE
@@ -4343,9 +4401,11 @@ render_status(VOID_ARGS)
* | Condition Codes | * | Condition Codes |
* +-----------------+ * +-----------------+
*/ */
if (!tty_condition_bits) bits = tty_condition_bits;
continue; /* if no bits are set, we can fall through condition
if (num_rows == 3) { rendering code to finalx[] handling (and subsequent
rest-of-line erasure if line is shorter than before) */
if (num_rows == 3 && bits != 0L) {
int k; int k;
char *dat = &cw->data[y][0]; char *dat = &cw->data[y][0];
@@ -4372,8 +4432,7 @@ render_status(VOID_ARGS)
tty_status[NOW][BL_CONDITION].x = x; tty_status[NOW][BL_CONDITION].x = x;
tty_curs(WIN_STATUS, x, y); tty_curs(WIN_STATUS, x, y);
} }
bits = tty_condition_bits; for (c = 0; c < SIZE(conditions) && bits != 0L; ++c) {
for (c = 0; c < SIZE(conditions); ++c) {
mask = conditions[c].mask; mask = conditions[c].mask;
if (bits & mask) { if (bits & mask) {
const char *condtext; const char *condtext;
@@ -4389,8 +4448,10 @@ render_status(VOID_ARGS)
condtext = conditions[c].text[cond_shrinklvl]; condtext = conditions[c].text[cond_shrinklvl];
if (x >= cw->cols && !truncation_expected) { if (x >= cw->cols && !truncation_expected) {
impossible( impossible(
"Unexpected condition placement overflow"); "Unexpected condition placement overflow for \"%s\"",
condtext);
condtext = ""; condtext = "";
bits = 0L; /* skip any remaining conditions */
} }
tty_putstatusfield(condtext, x, y); tty_putstatusfield(condtext, x, y);
x += (int) strlen(condtext); x += (int) strlen(condtext);
@@ -4399,8 +4460,7 @@ render_status(VOID_ARGS)
term_end_color(); term_end_color();
End_Attr(attrmask); End_Attr(attrmask);
} }
if (!(bits &= ~mask)) bits &= ~mask;
break;
} }
} }
/* 'x' is 1-based and 'cols' and 'data' are 0-based, /* 'x' is 1-based and 'cols' and 'data' are 0-based,
@@ -4501,9 +4561,10 @@ render_status(VOID_ARGS)
x += tlth; x += tlth;
} }
finalx[row][NOW] = x - 1; finalx[row][NOW] = x - 1;
/* reset .redraw and .dirty now that they're rendered */ /* reset .redraw and .dirty now that field has been rendered */
tty_status[NOW][idx].dirty = FALSE; tty_status[NOW][idx].dirty = FALSE;
tty_status[NOW][idx].redraw = FALSE; tty_status[NOW][idx].redraw = FALSE;
tty_status[NOW][idx].sanitycheck = FALSE;
/* /*
* For comparison of current and previous: * For comparison of current and previous:
* - Copy the entire tty_status struct. * - Copy the entire tty_status struct.