fix github issue #354 - stealarm() impossible
A thieving monster could be killed while the hero was busy taking off armor which needs multiple turns (normally a suit) and if that happened on the same turn as the take-off finished, the warning "stealarm(): dead monster stealing" was issued. Cited case was having the thief be killed by a stinking cloud but it could happen if the death was caused by a pet or by some other monster trying to attack the hero. If the thief died sooner, the situation was silently ignored. So this could have been fixed by just getting rid of the impossible() feedback. 'stealmid' and 'stealoid' should have been static in steal.c rather than global and as such should have been moved into 'struct g'. This moves them there and then takes advantage of having access to 'stealmid' outside of steal.c. That's just a minor optimization since m_detach() could call new thiefdead() unconditionally and the latter could check whether the dead monster matches 'stealmid'. Fixes #354
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 mon.c $NHDT-Date: 1586091449 2020/04/05 12:57:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.333 $ */
|
||||
/* NetHack 3.6 mon.c $NHDT-Date: 1591017419 2020/06/01 13:16:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.337 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1977,6 +1977,8 @@ struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */
|
||||
/* to prevent an infinite relobj-flooreffects-hmon-killed loop */
|
||||
mtmp->mtrapped = 0;
|
||||
mtmp->mhp = 0; /* simplify some tests: force mhp to 0 */
|
||||
if (mtmp->m_id == g.stealmid)
|
||||
thiefdead();
|
||||
relobj(mtmp, 0, FALSE);
|
||||
if (onmap || mtmp == g.level.monsters[0][0]) {
|
||||
if (mtmp->wormno)
|
||||
|
||||
Reference in New Issue
Block a user