fix discovered artifact panic

When known discoveries was displayed on a window of type NHW_MENU,
header lines sent to it via menu_add_heading() disappeared into the
bit bucket.  Switching back to putstr() made them show up.  But I also
changed the type to NHW_TEXT.  A menu_add_heading() in artifact.c was
overlooked, and after the window type change that started triggering
a panic when '\' or '`a' was used while any artifacts were discovered.

Not sure how other interfaces were dealing with this.
This commit is contained in:
PatR
2023-12-08 11:41:53 -08:00
parent ad833ce02d
commit 9ea2894448

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 artifact.c $NHDT-Date: 1654717838 2022/06/08 19:50:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.190 $ */
/* NetHack 3.7 artifact.c $NHDT-Date: 1702064500 2023/12/08 19:41:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.214 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1037,7 +1037,8 @@ undiscovered_artifact(xint16 m)
/* display a list of discovered artifacts; return their count */
int
disp_artifact_discoveries(winid tmpwin) /* supplied by dodiscover() */
disp_artifact_discoveries(
winid tmpwin) /* supplied by dodiscover(); type is NHW_TEXT */
{
int i, m, otyp;
const char *algnstr;
@@ -1050,7 +1051,7 @@ disp_artifact_discoveries(winid tmpwin) /* supplied by dodiscover() */
continue; /* for WIN_ERR, we just count */
if (i == 0)
add_menu_heading(tmpwin, "Artifacts");
putstr(tmpwin, iflags.menu_headings.attr, "Artifacts");
m = artidisco[i];
otyp = artilist[m].otyp;
algnstr = align_str(artilist[m].alignment);