]> granicus.if.org Git - nethack/commitdiff
github issue #688 - end of game livelog event
authorPatR <rankin@nethack.org>
Thu, 3 Mar 2022 15:47:56 +0000 (07:47 -0800)
committerPatR <rankin@nethack.org>
Thu, 3 Mar 2022 15:47:56 +0000 (07:47 -0800)
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
src/end.c
src/insight.c
src/zap.c
sys/unix/sysconf

index 39c7e13d240281d47c10d9c1ea4c245038c4c399..1d5d7b26fc19f40d2d9fe90e3dbf21ad6e8e6dc5 100644 (file)
@@ -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 */
index 84c9b7d949ae0f9a64cd149b195de35d5af47dc1..bf1f92ea640e3e0c8d3651acc2b27fdf978803b4 100644 (file)
--- 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);
     }
index e5e19369861bb95108f39c66f2dad5f92309934e..5df016c5a5807636f48b82f1678232ada757061d 100644 (file)
@@ -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)
index ee32788185532f94a53e07175652d2d075cfe9a6..365f6df4f454551b0591f787c8340e27f3827578 100644 (file)
--- 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) {
index b335bb503fd6c15797b79d965500e0b98810f8e4..9053c723616f10203af5a7be3e7abd720be668d9 100644 (file)
@@ -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