fix bz 103+#H4095 - high scores ", while helpless"

If a character dies with 'multi' at a non-zero value, the reason for
helplessness is appended to the cause of death.  But that was taking
place in writeentry(), which is used for every score entry while
rewriting 'record' when a new high score is added.  So whenever a new
score with helplessness was added, all existing entries got corrupted
by having the newest game's reason for helplessness tacked on.

Append the helplessness reason while formatting the cause of death
instead of when writing out score and logfile entries.  xlogfile is
handled a little differently in case the cause of death plus reason
for helplessness is too long so truncated for record and logfile.
Full reason is still put into xlogfile.
This commit is contained in:
PatR
2015-12-17 19:50:06 -08:00
parent 3e597b6882
commit 20b2120f3f
3 changed files with 46 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 rip.c $NHDT-Date: 1436753522 2015/07/13 02:12:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
/* NetHack 3.6 rip.c $NHDT-Date: 1450410547 2015/12/18 03:49:07 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.21 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -91,7 +91,7 @@ time_t when;
{
register char **dp;
register char *dpx;
char buf[BUFSZ];
char buf[BUFSZ], *p;
long year;
register int x;
int line;
@@ -113,6 +113,9 @@ time_t when;
/* Put together death description */
formatkiller(buf, sizeof buf, how);
/* strip ", while helpless" to keep reason shorter */
if ((p = strstr(buf, ", while")) != 0)
*p = '\0';
/* Put death type on stone */
for (line = DEATH_LINE, dpx = buf; line < YEAR_LINE; line++) {