dumplog revisions
I saw dumplog text in a newsgroup posting and the only way I could recognize what version generated it was that "You entered the dungeon N turns ago" included the missing-until-recently final period. So, put nethack's one-line version information as the very first dumplog text and follow it with the dumped game's start and end date+time. (That information is useful to know in its own right, but also should prevent the build date+time shown with the version from confusing anybody about when the dump was written.) Along the way, I noticed that the 'counting' phase for artifact_score was being repeated for '#if DUMPLOG' even though it doesn't generate output. That had a side-effect of adding points for artifacts twice (applicable when final score was for an ascension or dungeon escape).
This commit is contained in:
@@ -422,6 +422,8 @@ humanoid pet could become hostile but still remain tame if it observed hero
|
||||
attacking a peaceful creature
|
||||
minor ^X/enlightenment bugs: grammar when poly'd into '1 hit dice' critter,
|
||||
missing punctuation for "You entered the dungeon N turns ago"
|
||||
when configured with DUMPLOG enabled, artifacts were counted twice towards
|
||||
final score
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
79
src/end.c
79
src/end.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 end.c $NHDT-Date: 1489192539 2017/03/11 00:35:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.130 $ */
|
||||
/* NetHack 3.6 end.c $NHDT-Date: 1495232357 2017/05/19 22:19:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.131 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -59,7 +59,7 @@ STATIC_DCL boolean FDECL(should_query_disclose_option, (int, char *));
|
||||
#ifdef DUMPLOG
|
||||
STATIC_DCL void NDECL(dump_plines);
|
||||
#endif
|
||||
STATIC_DCL void FDECL(dump_everything, (int));
|
||||
STATIC_DCL void FDECL(dump_everything, (int, time_t));
|
||||
STATIC_DCL int NDECL(num_extinct);
|
||||
|
||||
#if defined(__BEOS__) || defined(MICRO) || defined(WIN32) || defined(OS2)
|
||||
@@ -680,8 +680,7 @@ dump_plines()
|
||||
extern char *saved_plines[];
|
||||
extern unsigned saved_pline_index;
|
||||
|
||||
Strcpy(buf, " ");
|
||||
putstr(0, 0, "");
|
||||
Strcpy(buf, " "); /* one space for indentation */
|
||||
putstr(0, 0, "Latest messages:");
|
||||
for (i = 0, j = (int) saved_pline_index; i < DUMPLOG_MSG_COUNT;
|
||||
++i, j = (j + 1) % DUMPLOG_MSG_COUNT) {
|
||||
@@ -697,27 +696,41 @@ dump_plines()
|
||||
}
|
||||
#endif
|
||||
|
||||
/*ARGSUSED*/
|
||||
STATIC_OVL void
|
||||
dump_everything(how)
|
||||
dump_everything(how, when)
|
||||
int how;
|
||||
time_t when; /* date+time at end of game */
|
||||
{
|
||||
#ifdef DUMPLOG
|
||||
struct obj *obj;
|
||||
char pbuf[BUFSZ];
|
||||
char pbuf[BUFSZ], datetimebuf[24]; /* [24]: room for 64-bit bogus value */
|
||||
|
||||
dump_redirect(TRUE);
|
||||
if (!iflags.in_dumplog)
|
||||
return;
|
||||
|
||||
init_symbols();
|
||||
init_symbols(); /* revert to default symbol set */
|
||||
|
||||
for (obj = invent; obj; obj = obj->nobj) {
|
||||
makeknown(obj->otyp);
|
||||
obj->known = obj->bknown = obj->dknown = obj->rknown = 1;
|
||||
if (Is_container(obj) || obj->otyp == STATUE)
|
||||
obj->cknown = obj->lknown = 1;
|
||||
}
|
||||
/* one line version ID, which includes build date+time;
|
||||
it's conceivable that the game started with a different
|
||||
build date+time or even with an older nethack version,
|
||||
but we only have access to the one it finished under */
|
||||
putstr(0, 0, getversionstring(pbuf));
|
||||
putstr(0, 0, "");
|
||||
|
||||
/* game start and end date+time to disambiguate version date+time */
|
||||
Strcpy(datetimebuf, yyyymmddhhmmss(ubirthday));
|
||||
Sprintf(pbuf, "Game began %4.4s-%2.2s-%2.2s %2.2s:%2.2s:%2.2s",
|
||||
&datetimebuf[0], &datetimebuf[4], &datetimebuf[6],
|
||||
&datetimebuf[8], &datetimebuf[10], &datetimebuf[12]);
|
||||
Strcpy(datetimebuf, yyyymmddhhmmss(when));
|
||||
Sprintf(eos(pbuf), ", ended %4.4s-%2.2s-%2.2s %2.2s:%2.2s:%2.2s.",
|
||||
&datetimebuf[0], &datetimebuf[4], &datetimebuf[6],
|
||||
&datetimebuf[8], &datetimebuf[10], &datetimebuf[12]);
|
||||
putstr(0, 0, pbuf);
|
||||
putstr(0, 0, "");
|
||||
|
||||
/* character name and basic role info */
|
||||
Sprintf(pbuf, "%s, %s %s %s %s", plname,
|
||||
aligns[1 - u.ualign.type].adj,
|
||||
genders[flags.female].adj,
|
||||
@@ -772,14 +785,7 @@ boolean taken;
|
||||
ask = should_query_disclose_option('i', &defquery);
|
||||
c = ask ? yn_function(qbuf, ynqchars, defquery) : defquery;
|
||||
if (c == 'y') {
|
||||
struct obj *obj;
|
||||
|
||||
for (obj = invent; obj; obj = obj->nobj) {
|
||||
makeknown(obj->otyp);
|
||||
obj->known = obj->bknown = obj->dknown = obj->rknown = 1;
|
||||
if (Is_container(obj) || obj->otyp == STATUE)
|
||||
obj->cknown = obj->lknown = 1;
|
||||
}
|
||||
/* caller has already ID'd everything */
|
||||
(void) display_inventory((char *) 0, TRUE);
|
||||
container_contents(invent, TRUE, TRUE, FALSE);
|
||||
}
|
||||
@@ -1166,10 +1172,26 @@ int how;
|
||||
if (have_windows)
|
||||
display_nhwindow(WIN_MESSAGE, FALSE);
|
||||
|
||||
if (strcmp(flags.end_disclose, "none") && how != PANICKED)
|
||||
disclose(how, taken);
|
||||
if (how != PANICKED) {
|
||||
struct obj *obj;
|
||||
|
||||
dump_everything(how);
|
||||
/*
|
||||
* This is needed for both inventory disclosure and dumplog.
|
||||
* Both are optional, so do it once here instead of duplicating
|
||||
* it in both of those places.
|
||||
*/
|
||||
for (obj = invent; obj; obj = obj->nobj) {
|
||||
makeknown(obj->otyp);
|
||||
obj->known = obj->bknown = obj->dknown = obj->rknown = 1;
|
||||
if (Is_container(obj) || obj->otyp == STATUE)
|
||||
obj->cknown = obj->lknown = 1;
|
||||
}
|
||||
|
||||
if (strcmp(flags.end_disclose, "none"))
|
||||
disclose(how, taken);
|
||||
|
||||
dump_everything(how, endtime);
|
||||
}
|
||||
|
||||
/* finish_paybill should be called after disclosure but before bones */
|
||||
if (bones_ok && taken)
|
||||
@@ -1319,11 +1341,6 @@ int how;
|
||||
|
||||
/* count the points for artifacts */
|
||||
artifact_score(invent, TRUE, endwin);
|
||||
#ifdef DUMPLOG
|
||||
dump_redirect(TRUE);
|
||||
artifact_score(invent, TRUE, endwin);
|
||||
dump_redirect(FALSE);
|
||||
#endif
|
||||
|
||||
viz_array[0][0] |= IN_SIGHT; /* need visibility for naming */
|
||||
mtmp = mydogs;
|
||||
@@ -1418,7 +1435,7 @@ int how;
|
||||
plur(umoney), moves, plur(moves));
|
||||
dump_forward_putstr(endwin, 0, pbuf, done_stopprint);
|
||||
Sprintf(pbuf,
|
||||
"You were level %d with a maximum of %d hit point%s when you %s.",
|
||||
"You were level %d with a maximum of %d hit point%s when you %s.",
|
||||
u.ulevel, u.uhpmax, plur(u.uhpmax), ends[how]);
|
||||
dump_forward_putstr(endwin, 0, pbuf, done_stopprint);
|
||||
dump_forward_putstr(endwin, 0, "", done_stopprint);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 windows.c $NHDT-Date: 1488075979 2017/02/26 02:26:19 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.39 $ */
|
||||
/* NetHack 3.6 windows.c $NHDT-Date: 1495232365 2017/05/19 22:19:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.41 $ */
|
||||
/* Copyright (c) D. Cohrs, 1993. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1033,7 +1033,7 @@ int behavior UNUSED, under UNUSED, over UNUSED;
|
||||
#endif /* STATUS_VIA_WINDOWPORT */
|
||||
|
||||
STATIC_VAR struct window_procs dumplog_windowprocs_backup;
|
||||
STATIC_PTR FILE *dumplog_file;
|
||||
STATIC_VAR FILE *dumplog_file;
|
||||
|
||||
#ifdef DUMPLOG
|
||||
STATIC_VAR time_t dumplog_now;
|
||||
@@ -1152,8 +1152,8 @@ void
|
||||
dump_close_log()
|
||||
{
|
||||
if (dumplog_file) {
|
||||
fclose(dumplog_file);
|
||||
dumplog_file = NULL;
|
||||
(void) fclose(dumplog_file);
|
||||
dumplog_file = (FILE *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user