New journal event output
To enable, set econfig key keep_journal to at least 2. Output events are *not* flushed to disk immediately. Put it in Hvy Metal II now to gather real data for future testing of a journal replay tool.
This commit is contained in:
parent
1c1fa720d4
commit
c4687e15d5
3 changed files with 20 additions and 1 deletions
|
@ -46,6 +46,7 @@
|
|||
* logout CNUM
|
||||
* command NAME
|
||||
* input INPUT
|
||||
* output THREAD ID OUTPUT
|
||||
* update ETU
|
||||
*/
|
||||
|
||||
|
@ -99,7 +100,8 @@ journal_entry(char *fmt, ...)
|
|||
fprintf(journal, "\\%03o", *p);
|
||||
}
|
||||
fputs("\n", journal);
|
||||
fflush(journal);
|
||||
if (fmt[0] != 'o') /* FIXME disgusting hack */
|
||||
fflush(journal);
|
||||
if (ferror(journal)) {
|
||||
logerror("Error writing journal (%s)", strerror(errno));
|
||||
clearerr(journal);
|
||||
|
@ -168,6 +170,17 @@ journal_logout(void)
|
|||
journal_entry("logout %d", player->cnum);
|
||||
}
|
||||
|
||||
void
|
||||
journal_output(struct player *pl, int id, char *output)
|
||||
{
|
||||
if (keep_journal < 2)
|
||||
return;
|
||||
if (pl && pl->state == PS_PLAYING)
|
||||
journal_entry("output %d %d %s", pl->cnum, id, output);
|
||||
else
|
||||
journal_entry("output %p %d %s", pl, id, output);
|
||||
}
|
||||
|
||||
void
|
||||
journal_input(char *input)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue