]> granicus.if.org Git - nethack/commitdiff
bones tracking (trunk only)
authornethack.rankin <nethack.rankin>
Mon, 23 Jan 2012 10:41:57 +0000 (10:41 +0000)
committernethack.rankin <nethack.rankin>
Mon, 23 Jan 2012 10:41:57 +0000 (10:41 +0000)
      Quite a long time ago, the developer/administrator of the 'hearse'
bones respository asked to have bones files augmented so that they could
be correlated with logfile entries.  He was forced to approximate it by
comparing file date+time with logfile date, which won't work well if there
are multiple deaths at roughly the same time, or perhaps even on the same
day.  This adds character name plus role, race, gender, alignment, the
cause of death, and date plus time of death to the bones file when it is
saved, and reads that data in when a bones file is loaded, then retains
it as part of that level for the remainder of the game.  Dying on a level
that was loaded from bones will chain the new dead hero info to whatever
was there from the previous one(s).  It's written as fixed length strings
padded with spaces before writing the map and its messy details, making
it easy to spot with a simple file browsing tool rather than requiring
something which can interpret nethack level files.  This may need to be
tweaked if players start shelling out of nethack to see whether the
checkpoint file for a newly entered level contains bones info, but at the
moment I'm not going to worry about that.

     TODO:  I wanted the bones and topten date to match, so am obtaining
the current date+time in done() and passing it to both of those and also
to outrip().  Hence the latter now has an additional argument.  So far only
genl_outrip() and hup_outrip() in src and the three outrips in win/chain
have been taught about that; interfaces that supply their own outrip()
need to be updated and probably won't compile right now.  Also, code for
formatting the cause of death has been moved from topten() into a separate
routine so that the new bones code can share it.  genl_outrip() now calls
it too; the various other outrip() routines should be changed to call it
instead of continuing to duplicate that core code.  (I probably should
have made topten.c's killed_by_prefix[] be static in order to force that,
but haven't done so.)

     TODO too:  there ought to be some way of viewing the data for a loaded
bones file from within nethack.  I'll probably add something to the dungeon
overview code to treat it as an implicit annotation, as least in wizard mode.
Showing it in normal play once a level is sufficiently discovered would be
useful, but I'm not sure what criteria should control that.  Neither ghost
nor grave is guaranteed to be present, particularly for levels that were
saved as bones, loaded into a subsequent game, then became new bones when
the second hero died there, which can occur an arbitrary number of times.

doc/fixes35.0
doc/window.doc
include/rm.h

index 486275a3192763f8d78dc12b869e10997abaafa3..e3d5965cb2986bba502ce8405766e606c77d8214 100644 (file)
@@ -550,6 +550,7 @@ add "about nethack" to '?' menu as an alternate way to view 'v'+'#version'
 display version and build information at startup
 repeatedly setting the fruit option will check to see if fruits have been
     created, so the user can't easily overflow the maximum this way
+bones files now include extra data to identify dead hero and reason for death
 
 
 Platform- and/or Interface-Specific New Features
index 1f5544f58280dba30ca4ae8b67eb8facd830310c..5e4842f087b607f3b1e61eef21f296fa190dd647 100644 (file)
@@ -501,7 +501,7 @@ start_screen()      -- Only used on Unix tty ports, but must be declared for
 end_screen()   -- Only used on Unix tty ports, but must be declared for
                   completeness.  The complement of start_screen().
 
-outrip(winid, int)
+outrip(winid, int, time_t)
                -- The tombstone code.  If you want the traditional code use
                   genl_outrip for the value and check the #if in rip.c.
 
index f32e945571c1a378c7912fab09c53d97e9ac0153..450843a59a43ef12c85c956639299e954f183710 100644 (file)
@@ -495,6 +495,18 @@ struct damage {
        schar typ;
 };
 
+/* for bones levels:  identify the dead character, who might have died on
+   an existing bones level; if so, most recent victim will be first in list */
+struct cemetery {
+       struct cemetery *next; /* next struct is previous dead character... */
+       /* "plname" + "-ROLe" + "-RACe" + "-GENder" + "-ALIgnment" + \0 */
+       char who[PL_NSIZ + 4*(1+3) + 1];
+       /* death reason, same as in score/log file */
+       char how[100 + 1]; /* [DTHSZ+1] */
+       /* date+time in string of digits rather than binary */
+       char when[4+2+2 + 2+2+2 + 1]; /* "YYYYMMDDhhmmss\0" */
+};
+
 struct levelflags {
        uchar   nfountains;             /* number of fountains on level */
        uchar   nsinks;                 /* number of sinks on the level */
@@ -520,6 +532,9 @@ struct levelflags {
        Bitfield(is_maze_lev,1);
        Bitfield(is_cavernous_lev,1);
        Bitfield(arboreal, 1);          /* Trees replace rock */
+       Bitfield(wizard_bones,1);       /* set if level came from a bones file
+                                          which was created in wizard mode (or
+                                          normal mode descendant of such) */
 };
 
 typedef struct
@@ -538,6 +553,7 @@ typedef struct
     struct obj         *buriedobjlist;
     struct monst       *monlist;
     struct damage      *damagelist;
+    struct cemetery     *bonesinfo;
     struct levelflags  flags;
 }
 dlevel_t;