breaking wielded fragile item against iron bars

Reported by entrez, wielding something fragile (potion of acid
perhaps), and using F to smash it against iron bars called breaktest()
directly, then a second time indirectly through hero_breaks() via
hit_bars().  There is a random chance to resist breaking (99% for
artifacts, 1% for other items) so breaktest() might say that something
will break on the first call and that it will not break on the second
call, or vice versa.  That could remove uwep from inventory then leave
it in limbo without destroying it, or destroy uwep without removing it
from inventory first triggering impossible "obfree: deleting worn obj".
This commit is contained in:
PatR
2021-10-22 19:11:51 -07:00
parent 56f79dd207
commit 37e63f6829
8 changed files with 97 additions and 61 deletions

View File

@@ -565,7 +565,7 @@ extern boolean throwing_weapon(struct obj *);
extern void throwit(struct obj *, long, boolean, struct obj *);
extern int omon_adj(struct monst *, struct obj *, boolean);
extern int thitmonst(struct monst *, struct obj *);
extern int hero_breaks(struct obj *, xchar, xchar, boolean);
extern int hero_breaks(struct obj *, xchar, xchar, unsigned);
extern int breaks(struct obj *, xchar, xchar);
extern void release_camera_demon(struct obj *, xchar, xchar);
extern void breakobj(struct obj *, xchar, xchar, boolean, boolean);
@@ -1637,7 +1637,7 @@ extern int breamm(struct monst *, struct attack *, struct monst *);
extern void m_useupall(struct monst *, struct obj *);
extern void m_useup(struct monst *, struct obj *);
extern void m_throw(struct monst *, int, int, int, int, int, struct obj *);
extern void hit_bars(struct obj **, int, int, int, int, boolean, boolean);
extern void hit_bars(struct obj **, int, int, int, int, unsigned);
extern boolean hits_bars(struct obj **, int, int, int, int, int, int);
/* ### muse.c ### */