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:
@@ -522,6 +522,15 @@ enum bodypart_types {
|
||||
exiting early with "You don't have anything to
|
||||
foo" if nothing in inventory is valid) */
|
||||
|
||||
/* flags for hero_breaks() and hits_bars(); BRK_KNOWN* let callers who have
|
||||
already called breaktest() prevent it from being called again since it
|
||||
has a random factor which makes it be non-deterministic */
|
||||
#define BRK_BY_HERO 1
|
||||
#define BRK_FROM_INV 2
|
||||
#define BRK_KNOWN2BREAK 4
|
||||
#define BRK_KNOWN2NOTBREAK 8
|
||||
#define BRK_KNOWN_OUTCOME (BRK_KNOWN2BREAK | BRK_KNOWN2NOTBREAK)
|
||||
|
||||
/* values returned from getobj() callback functions */
|
||||
enum getobj_callback_returns {
|
||||
/* generally invalid - can't be used for this purpose. will give a "silly
|
||||
|
||||
Reference in New Issue
Block a user