Skip to content

Commit 6a055e2

Browse files
committed
Fix: crash in relation to tainted (drow poison) objects.
Monsters were being put to sleep by tainted weapons even after being killed. Oops. Also a bit of code formatting here.
1 parent 25e9eb0 commit 6a055e2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

doc/evilhack-changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -3507,4 +3507,5 @@ The following changes to date are:
35073507
when rile_shk() routine was called
35083508
- Fix: bracers should not be a suitable target when applying
35093509
a dwarvish bearded axe towards the player or a monster
3510+
- Fix: crash in relation to tainted (drow poison) objects
35103511

src/uhitm.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -2164,7 +2164,7 @@ int dieroll;
21642164
obj->oprops_known |= ITEM_VENOM;
21652165
update_inventory();
21662166
}
2167-
} else if (taintsleep) {
2167+
} else if (taintsleep && !destroyed) {
21682168
if (sleep_monst(mon, rn2(3) + 2, WEAPON_CLASS)) {
21692169
pline("%s loses consciousness.", Monnam(mon));
21702170
slept_monst(mon);
@@ -2182,8 +2182,10 @@ int dieroll;
21822182
}
21832183
}
21842184

2185-
if (DEADMONSTER(mon) && !ispotion && obj /* potion obj will have been freed by here */
2186-
&& (obj == uwep || (u.twoweap && obj == uswapwep)) && issecespita
2185+
if (destroyed && !ispotion && obj /* potion obj will have been freed by here */
2186+
&& (obj == uwep
2187+
|| (u.twoweap && obj == uswapwep))
2188+
&& issecespita
21872189
&& !nonliving(mdat) && u.uen < u.uenmax) {
21882190
int energy = mon->m_lev + 1;
21892191

0 commit comments

Comments
 (0)