life support for comatose code in explmu()
Static analysis notices that
if (physical_damage)
tmp = Maybe_Half_Phys(tmp);
will never pass the test because all code paths leading to it set
'physical_damage' to False. Instead of getting rid of it, add a fake
case that leaves that True.
This commit is contained in:
13
src/mhitu.c
13
src/mhitu.c
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 mhitu.c $NHDT-Date: 1540767817 2018/10/28 23:03:37 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.159 $ */
|
/* NetHack 3.6 mhitu.c $NHDT-Date: 1545130893 2018/12/18 11:01:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.160 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -1989,12 +1989,12 @@ boolean ufound;
|
|||||||
if (mtmp->mcan)
|
if (mtmp->mcan)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!ufound)
|
if (!ufound) {
|
||||||
pline("%s explodes at a spot in %s!",
|
pline("%s explodes at a spot in %s!",
|
||||||
canseemon(mtmp) ? Monnam(mtmp) : "It",
|
canseemon(mtmp) ? Monnam(mtmp) : "It",
|
||||||
levl[mtmp->mux][mtmp->muy].typ == WATER ? "empty water"
|
levl[mtmp->mux][mtmp->muy].typ == WATER ? "empty water"
|
||||||
: "thin air");
|
: "thin air");
|
||||||
else {
|
} else {
|
||||||
int tmp = d((int) mattk->damn, (int) mattk->damd);
|
int tmp = d((int) mattk->damn, (int) mattk->damd);
|
||||||
boolean not_affected = defends((int) mattk->adtyp, uwep);
|
boolean not_affected = defends((int) mattk->adtyp, uwep);
|
||||||
|
|
||||||
@@ -2012,6 +2012,13 @@ boolean ufound;
|
|||||||
case AD_ELEC:
|
case AD_ELEC:
|
||||||
physical_damage = FALSE;
|
physical_damage = FALSE;
|
||||||
not_affected |= Shock_resistance;
|
not_affected |= Shock_resistance;
|
||||||
|
goto common;
|
||||||
|
case AD_PHYS:
|
||||||
|
/* there aren't any exploding creatures with AT_EXPL attack
|
||||||
|
for AD_PHYS damage but there might be someday; without this,
|
||||||
|
static analysis complains that 'physical_damage' is always
|
||||||
|
False when tested below; it's right, but having that in
|
||||||
|
place means one less thing to update if AD_PHYS gets added */
|
||||||
common:
|
common:
|
||||||
|
|
||||||
if (!not_affected) {
|
if (!not_affected) {
|
||||||
|
|||||||
Reference in New Issue
Block a user