fix #H7686 - destroy_item()'s inventory traversal

Inventory traversal can be disrupted when items being traversed are
able to change inventory.  I've lost track of how many times this
sort of thing has been discovered.

Report claimed that boiled potion of polymorph caused transformation
which resulted in dropped weapon and dropped or destroyed worn armor.
That was evidently a guess; potionbreathe() for that potion only
abuses constitution.  The traceback showed 'you_were()' was involved.
Boiled potion of unholy water triggers human-to-beast transformation
of hero inflicted with lycanthropy, yielding similar situation.

I didn't notice anything unusual when reproducing this but inventory
was definitely vulnerable.  My 'one line' fixes entries are steadily
getting to be more verbose; I may have to go back to 'fix bug'.  :-}
This commit is contained in:
PatR
2018-12-06 17:27:36 -08:00
parent a9e8ad9236
commit e9624f2583
2 changed files with 38 additions and 9 deletions

View File

@@ -243,6 +243,14 @@ level change after being interruped locking or unlocking a container might
if a restore attempt failed and a new game was started instead, it would use
stale context from old game if restoration got far enough to load that
if hero survives turning into slime (life-saving), survive as a green slime
hero hit by something that causes inventory items to be destroyed with loss of
any of those causing other inventory items to be dropped or destroyed,
inventory traversal became unreliable (known sequence: potions hit by
fire then breahing vapor from boiled unholy water triggering were
transformation to beast form; possible sequence: ring of levitation
blasted by lightning and dropping hero onto fire trap); [3.6.1 fixed a
similar problem with more obvious symptom, an "object lost" panic when
the unholy water was wielded; the fix for that wasn't general enough]
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository