From 93928640c616967e3934004ef701ee3d14e2612d Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 3 Mar 2022 07:47:56 -0800 Subject: [PATCH] github issue #688 - end of game livelog event Requested by k21971 (hardfought admin): classify the gameover event as something other than achievement so that live-logging can exclude it in order to use the xlogfile end-of-game entry instead. It had been classified as an achievement because that was the only category being treated as 'major' so written to final dumplog. Give is a new classification 'dump' which is distinct from achievement and intended to explicitly request that an event go into dumplog. The gameover event is the only one in that category, at least for now. Add a bunch of other classifications besides achievement and dump to be treated as 'major' for dumplog. The new list is wish, achieve, umonst (death of unique monster), divinegift, lifesave (via amulet, not explore-/wizard-mode decline to die), artifact, genocide, dump and may still need further tuning. Currently excluded are conduct (first violation of any conduct), killedpet, alignment (changed, either via helmet or conversion), minorac (minor achievement such as level gain or entering the mines), and spoiler (currently only applies to finding Mines' End luckstone which is also 'achieve' so will be in dumplog). This doesn't remove the reference to unimplemented LLC_TURNS that is mentioned in the template sysconf. Closes #688 --- include/global.h | 5 +++-- src/end.c | 8 ++++---- src/insight.c | 18 ++++++++++++++---- src/zap.c | 15 +++++++++------ sys/unix/sysconf | 4 +++- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/include/global.h b/include/global.h index 39c7e13d2..1d5d7b26f 100644 --- a/include/global.h +++ b/include/global.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 global.h $NHDT-Date: 1646136933 2022/03/01 12:15:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.134 $ */ +/* NetHack 3.7 global.h $NHDT-Date: 1646322467 2022/03/03 15:47:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.135 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -478,8 +478,9 @@ extern struct nomakedefs_s nomakedefs; #define LL_DUMP_ASC 0x0400L /* Log URL for dumplog if ascended */ #define LL_DUMP_ALL 0x0800L /* Log dumplog url for all games */ #define LL_MINORAC 0x1000L /* Log 'minor' achievements - can be spammy */ -#define LL_SPOILER 0x4000L /* reveals information so don't show in-game +#define LL_SPOILER 0x2000L /* reveals information so don't show in-game * via #chronicle unless in wizard mode */ +#define LL_DUMP 0x4000L /* none of the above but should be in dumplog */ #define LL_DEBUG 0x8000L /* For debugging messages and other spam */ #endif /* GLOBAL_H */ diff --git a/src/end.c b/src/end.c index 84c9b7d94..bf1f92ea6 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 end.c $NHDT-Date: 1646136940 2022/03/01 12:15:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.239 $ */ +/* NetHack 3.7 end.c $NHDT-Date: 1646322468 2022/03/03 15:47:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.240 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1392,12 +1392,12 @@ really_done(int how) disclose(how, taken); /* it would be better to do this after killer.name fixups but - that comes too late; end-of-game is classified as a "major - achievement" even if game happens to be ending in failure */ + that comes too late; included in final dumplog but might be + excluded by active livelog */ formatkiller(pbuf, (unsigned) sizeof pbuf, how, TRUE); if (!*pbuf) Strcpy(pbuf, deaths[how]); - livelog_printf(LL_ACHIEVE, "%s", pbuf); + livelog_printf(LL_DUMP, "%s", pbuf); dump_everything(how, endtime); } diff --git a/src/insight.c b/src/insight.c index e5e193698..5df016c5a 100644 --- a/src/insight.c +++ b/src/insight.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 insight.c $NHDT-Date: 1646171624 2022/03/01 21:53:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.54 $ */ +/* NetHack 3.7 insight.c $NHDT-Date: 1646322468 2022/03/03 15:47:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.55 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2363,9 +2363,6 @@ sokoban_in_play(void) return FALSE; } -#define majorevent(llmsg) (((llmsg)->flags & LL_ACHIEVE) != 0) -#define spoilerevent(llmsg) (((llmsg)->flags & LL_SPOILER) != 0) - /* #chronicle command */ int do_gamelog(void) @@ -2382,6 +2379,19 @@ do_gamelog(void) return ECMD_OK; } +/* 'major' events for dumplog; inclusion or exclusion here may need tuning */ +#define LL_majors (0L \ + | LL_WISH \ + | LL_ACHIEVE \ + | LL_UMONST \ + | LL_DIVINEGIFT \ + | LL_LIFESAVE \ + | LL_ARTIFACT \ + | LL_GENOCIDE \ + | LL_DUMP) /* explicitly for dumplog */ +#define majorevent(llmsg) (((llmsg)->flags & LL_majors) != 0) +#define spoilerevent(llmsg) (((llmsg)->flags & LL_SPOILER) != 0) + /* #chronicle details */ void show_gamelog(int final) diff --git a/src/zap.c b/src/zap.c index ee3278818..365f6df4f 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 zap.c $NHDT-Date: 1629817679 2021/08/24 15:07:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.372 $ */ +/* NetHack 3.7 zap.c $NHDT-Date: 1646322469 2022/03/03 15:47:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.400 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -5551,6 +5551,7 @@ makewish(void) char promptbuf[BUFSZ]; char bufcpy[BUFSZ]; struct obj *otmp, nothing; + long maybe_LL_arti; int tries = 0; int prev_artwish = u.uconduct.wisharti; @@ -5593,15 +5594,17 @@ makewish(void) return; } + maybe_LL_arti = ((prev_artwish < u.uconduct.wisharti) ? LL_ARTIFACT : 0L); /* KMH, conduct */ if (!u.uconduct.wishes++) - livelog_printf(LL_CONDUCT | LL_WISH | (prev_artwish < u.uconduct.wisharti ? LL_ARTIFACT : 0), + livelog_printf((LL_CONDUCT | LL_WISH | maybe_LL_arti), "made %s first wish - \"%s\"", uhis(), bufcpy); - else if (!prev_artwish && u.uconduct.wisharti) /* arti conduct handled in readobjnam() above */ - livelog_printf(LL_CONDUCT | LL_WISH | LL_ARTIFACT, "made %s first artifact wish - \"%s\"", - uhis(), bufcpy); + else if (!prev_artwish && u.uconduct.wisharti) /* wisharti conduct handled + * in readobjnam() above */ + livelog_printf((LL_CONDUCT | LL_WISH | LL_ARTIFACT), + "made %s first artifact wish - \"%s\"", uhis(), bufcpy); else - livelog_printf(LL_WISH | (prev_artwish < u.uconduct.wisharti ? LL_ARTIFACT : 0), + livelog_printf((LL_WISH | maybe_LL_arti), "wished for \"%s\"", bufcpy); if (otmp != &cg.zeroobj) { diff --git a/sys/unix/sysconf b/sys/unix/sysconf index b335bb503..9053c7236 100644 --- a/sys/unix/sysconf +++ b/sys/unix/sysconf @@ -1,4 +1,4 @@ -# NetHack 3.7 sysconf $NHDT-Date: 1596498296 2020/08/03 23:44:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.39 $ +# NetHack 3.7 sysconf $NHDT-Date: 1646322470 2022/03/03 15:47:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.41 $ # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland # NetHack may be freely redistributed. See license for details. # @@ -106,6 +106,8 @@ MAXPLAYERS=10 # 0x0400 - Log URL for dumplog if ascended # 0x0800 - Log dumplog url for all games # 0x1000 - Log 'minor' achievements - can be spammy +# 0x2000 - Spoiler event; can include in livelog but hidden from #chronicle +# 0x4000 - Include as 'major' event in dumplog; can be hidden from livelog # 0x8000 - Livelog debug msgs (currently only 'enter new level') #LIVELOG=0x1FFF