From 8fe02c2a7cb0222fa22c2f7021b708b01b179cae Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 20 Jan 2025 08:39:33 -0800 Subject: [PATCH] analyzer "lint" for muse.c fix Overzealous change yesterday. For use_defensive(), the unicorn horn case already has guards for Null item and the added one issues bogus panic() when a unicorn or ki-rin uses its own horn. --- src/muse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/muse.c b/src/muse.c index 5715e9342..b044af098 100644 --- a/src/muse.c +++ b/src/muse.c @@ -816,8 +816,7 @@ use_defensive(struct monst *mtmp) switch (gm.m.has_defense) { case MUSE_UNICORN_HORN: - if (!otmp) - panic(MissingDefensiveItem, "unicorn horn"); + /* unlike most defensive cases, unicorn horn object is optional */ if (vismon) { if (otmp) pline_mon(mtmp, "%s uses a unicorn horn!", Monnam(mtmp)); @@ -830,8 +829,9 @@ use_defensive(struct monst *mtmp) mtmp->mconf = mtmp->mstun = 0; if (vismon) pline_mon(mtmp, "%s seems steadier now.", Monnam(mtmp)); - } else + } else { impossible("No need for unicorn horn?"); + } return 2; case MUSE_BUGLE: if (!otmp)