Add end-of-game dumplogs
This is based on the "new" dumplog patch for 3.6.0, by Maxime Bacoux. Define DUMPLOG to enable. By default only enabled for the TTY linux.
This commit is contained in:
13
src/pline.c
13
src/pline.c
@@ -14,6 +14,10 @@ static char *FDECL(You_buf, (int));
|
||||
static void FDECL(execplinehandler, (const char *));
|
||||
#endif
|
||||
|
||||
#ifdef DUMPLOG
|
||||
char* saved_plines[DUMPLOG_MSG_COUNT] = {0};
|
||||
#endif
|
||||
|
||||
/*VARARGS1*/
|
||||
/* Note that these declarations rely on knowledge of the internals
|
||||
* of the variable argument handling stuff in "tradstdc.h"
|
||||
@@ -87,6 +91,15 @@ VA_DECL(const char *, line)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DUMPLOG
|
||||
/* We hook here early to have options-agnostic output. */
|
||||
free(saved_plines[DUMPLOG_MSG_COUNT - 1]);
|
||||
for (ln = 0; ln < DUMPLOG_MSG_COUNT - 1; ++ln)
|
||||
saved_plines[DUMPLOG_MSG_COUNT - ln - 1] = saved_plines[DUMPLOG_MSG_COUNT - ln - 2];
|
||||
saved_plines[0] = malloc(strlen(line) + 1);
|
||||
(void) strcpy(saved_plines[0], line);
|
||||
#endif
|
||||
|
||||
msgtyp = msgtype_type(line, no_repeat);
|
||||
if (msgtyp == MSGTYP_NOSHOW
|
||||
|| (msgtyp == MSGTYP_NOREP && !strcmp(line, prevmsg)))
|
||||
|
||||
Reference in New Issue
Block a user