more wish logging - show the result

Extend the log event for a wish to include what was produced.  It
would be better to show the item as fully ID'd but then #chronicle
gives away information.

The backslash+newline pairs were inserted for this log message.  In
the game and in dumplog those two lines are each one wide line.  The
turn numbers shown are actually arbitrary since ^W takes no time.

|Logged events:
| Turn
|    1: wizard the chaotic male orcish Wizard entered the dungeon
|    2: made his first wish - "protection", got "a tattered cape"
|    3: made his first artifact wish - "blessed +2 rustproof magicbane",\
 got "an athame named Magicbane"
|    4: wished for "master key of thievery", got "a key named The Master\
 Key of Thievery"
This commit is contained in:
PatR
2022-06-02 07:51:54 -07:00
parent c413233a4f
commit e764026a1f
+6 -7
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 zap.c $NHDT-Date: 1653329964 2022/05/23 18:19:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.415 $ */ /* NetHack 3.7 zap.c $NHDT-Date: 1654181493 2022/06/02 14:51:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.421 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -5630,8 +5630,7 @@ void
makewish(void) makewish(void)
{ {
char buf[BUFSZ] = DUMMY; char buf[BUFSZ] = DUMMY;
char promptbuf[BUFSZ]; char bufcpy[BUFSZ], wish[BUFSZ], promptbuf[QBUFSZ];
char bufcpy[BUFSZ];
struct obj *otmp, nothing; struct obj *otmp, nothing;
long maybe_LL_arti; long maybe_LL_arti;
int tries = 0; int tries = 0;
@@ -5684,16 +5683,16 @@ makewish(void)
/* wisharti conduct handled in readobjnam() */ /* wisharti conduct handled in readobjnam() */
maybe_LL_arti = ((oldwisharti < u.uconduct.wisharti) ? LL_ARTIFACT : 0L); maybe_LL_arti = ((oldwisharti < u.uconduct.wisharti) ? LL_ARTIFACT : 0L);
Snprintf(wish, sizeof wish, "\"%s\", got \"%s\"", bufcpy, doname(otmp));
/* KMH, conduct */ /* KMH, conduct */
if (!u.uconduct.wishes++) if (!u.uconduct.wishes++)
livelog_printf((LL_CONDUCT | LL_WISH | maybe_LL_arti), livelog_printf((LL_CONDUCT | LL_WISH | maybe_LL_arti),
"made %s first wish - \"%s\"", uhis(), bufcpy); "made %s first wish - %s", uhis(), wish);
else if (!oldwisharti && u.uconduct.wisharti) else if (!oldwisharti && u.uconduct.wisharti)
livelog_printf((LL_CONDUCT | LL_WISH | LL_ARTIFACT), livelog_printf((LL_CONDUCT | LL_WISH | LL_ARTIFACT),
"made %s first artifact wish - \"%s\"", uhis(), bufcpy); "made %s first artifact wish - %s", uhis(), wish);
else else
livelog_printf((LL_WISH | maybe_LL_arti), livelog_printf((LL_WISH | maybe_LL_arti), "wished for %s", wish);
"wished for \"%s\"", bufcpy);
/* TODO? maybe generate a second event decribing what was received since /* TODO? maybe generate a second event decribing what was received since
those just echo player's request rather than show actual result */ those just echo player's request rather than show actual result */