From 9ea2894448de23bce4d93b36e52ba5a9451a75f1 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 8 Dec 2023 11:41:53 -0800 Subject: [PATCH] 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. --- src/artifact.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/artifact.c b/src/artifact.c index a79d828bd..db303b7a9 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -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);