Open Soviet5lo opened 2 years ago
It's kind of a PITA to deal with this in the right way but it's worth doing
I think the problem is that water_damage
generally targets a chain of items and doesn't report when any object has been destroyed, so any references afterwards could operate on an object that isn't there (use after frees and other crashes for example)
vanilla splits up the water_damage
function to one that specifically targets a single item (reporting using a return value what happened to that object, e.g. ER_DESTROYED) and a water_damage_chain
that focuses on an item chain
That's probably what we should do here too, might try that at the weekend
If we split that out then in e.g. dropping the potion of acid we can check whether the potion was destroyed then avoid continuing on with the item at that point
When dropping a potion of acid into a puddle, the potion will explode but the potion is still available on the space. If a few other items are dropped on the same space, the player steps away and returns to the same spot the items are heavily corrupted before crashing with the following backtrace:
Dropping multiple (+8?) items on the spot, navigating away and returning to the spot procudes a different crash when attempting to pick up an object:
Dropping potions of acid into a pool however tends to result in an immediate crash with the following backtrace
Will attempt to pull further details (address sanitizer) later