'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.
This commit is contained in:
PatR
2022-09-22 15:34:16 -07:00
parent fbb32ea7fa
commit e3acbcab31

View File

@@ -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);