From e3acbcab3110ab607b8379246886a918d8cf8782 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 22 Sep 2022 15:34:16 -0700 Subject: [PATCH] 'fix' #K3676 - artifact_hit()'s magr Someone asked whether the 'magr' argument to artifact_hit() can be Null or not since the code sometimes checks whether it is Null and other times uses it unconditonally. The answer is "it depends." Can't reply to asker due to forced anonymity when the contact form was submitted. --- src/artifact.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/artifact.c b/src/artifact.c index 14019ba3a..ed9e63d9c 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1329,9 +1329,12 @@ DISABLE_WARNING_FORMAT_NONLITERAL * Stormbringer it's "killed by Stormbringer" instead of "killed by an orc". */ boolean -artifact_hit(struct monst *magr, struct monst *mdef, struct obj *otmp, - int *dmgptr, - int dieroll) /* needed for Magicbane and vorpal blades */ +artifact_hit( + struct monst *magr, /* attacker; might be Null if 'mdef' is youmonst */ + struct monst *mdef, /* defender */ + struct obj *otmp, /* artifact weapon */ + int *dmgptr, /* output */ + int dieroll) /* needed for Magicbane and vorpal blades */ { boolean youattack = (magr == &g.youmonst); boolean youdefend = (mdef == &g.youmonst);