]> git.pond.sub.org Git - empserver/commitdiff
Use country number as journal thread ID when possible
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 29 Jul 2008 11:32:36 +0000 (07:32 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 29 Jul 2008 11:32:36 +0000 (07:32 -0400)
Before, we used the value of empth_thread().  That can be mapped to
countries by tracking login and logout.  Easy for machines (except
when the journal is rotated while players are logged in), but tedious
for humans.

Quick version for Hvy Metal II.  Needs further work for the stock
code.

src/lib/subs/journal.c

index 7f45052471a528fd8df4fb9f118818be39db49f2..bfb1e9ecad735a91e66f955580fd94db7b7b81b5 100644 (file)
@@ -80,8 +80,12 @@ journal_entry(char *fmt, ...)
 
     if (journal) {
        time(&now);
-       fprintf(journal, "%.24s %p ", ctime(&now), empth_self());
-       
+       fprintf(journal, "%.24s ", ctime(&now));
+       if (player && player->state == PS_PLAYING)
+           fprintf(journal, "%d ", player->cnum);
+       else
+           fprintf(journal, "%p ", empth_self());
+
        va_start(ap, fmt);
        vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
        va_end(ap);