Archipelago icon indicating copy to clipboard operation
Archipelago copied to clipboard

Core - Added classification check to Item Equality

Open agilbert1412 opened this issue 11 months ago • 4 comments

What is this fixing or adding?

Item equality comparison did not consider classifications. Since the case where the same item exists in many instances, with different classifications, is supported (and even often encouraged), this is a flaw in the system, where equality comparisons can get it wrong sometimes, for example removing or filtering the wrong items from collections

How was this tested?

Ran all the unit tests, plus my case that had a problem because of this

Discord Conversation: https://discord.com/channels/731205301247803413/731214280439103580/1222014497552597054

agilbert1412 avatar Mar 26 '24 03:03 agilbert1412

I wonder if a better solution might be checking that self is other

Seems like this would solve a lot of issues that have come up where .remove() removes the wrong instance of an item from a list, etc? Not sure if it might break anything anywhere though.

Alchav avatar Mar 26 '24 16:03 Alchav

It has been discovered, shortly after the creation of this PR, that plando and start inventory from pool rely on this "incomplete" equality to work properly.

These would need to get fixed as well, for this PR to be acceptable.

This is now out of my area of expertise, so I'm leaving it to anyone who wishes to bother. I'll be working around the bug from now on

agilbert1412 avatar Mar 26 '24 16:03 agilbert1412

Incidentally I think self is other would cause issues here as well

BadMagic100 avatar Mar 26 '24 19:03 BadMagic100

If this changes, the classification should also be added to __hash__

beauxq avatar Mar 29 '24 13:03 beauxq