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 decl.h $NHDT-Date: 1589326665 2020/05/12 23:37:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.236 $ */
|
||||
/* NetHack 3.6 decl.h $NHDT-Date: 1591017415 2020/06/01 13:16:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.237 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2007. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1142,6 +1142,10 @@ struct instance_globals {
|
||||
int spl_sortmode; /* index into spl_sortchoices[] */
|
||||
int *spl_orderindx; /* array of g.spl_book[] indices */
|
||||
|
||||
/* steal.c */
|
||||
unsigned int stealoid; /* object to be stolen */
|
||||
unsigned int stealmid; /* monster doing the stealing */
|
||||
|
||||
/* teleport.c */
|
||||
struct obj *telescroll; /* non-null when teleporting via this scroll */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1590904081 2020/05/31 05:48:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.847 $ */
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1591017416 2020/06/01 13:16:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.848 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2536,9 +2536,11 @@ E void FDECL(initialspell, (struct obj *));
|
||||
|
||||
#ifdef USE_TRAMPOLI
|
||||
E int NDECL(stealarm);
|
||||
E void NDECL(unstolenarm);
|
||||
#endif
|
||||
E long FDECL(somegold, (long));
|
||||
E void FDECL(stealgold, (struct monst *));
|
||||
E void NDECL(thiefdead);
|
||||
E void FDECL(remove_worn_item, (struct obj *, BOOLEAN_P));
|
||||
E int FDECL(steal, (struct monst *, char *));
|
||||
E int FDECL(mpickobj, (struct monst *, struct obj *));
|
||||
|
||||
Reference in New Issue
Block a user