Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTTP: fix some hashed string comparisons #2927

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

alwaysintreble
Copy link
Collaborator

What is this fixing or adding?

an option can't be compared to strings in a set due to hashing

How was this tested?

Unit tests and a few generations with debugging

If this makes graphical changes, please attach screenshots.

@alwaysintreble alwaysintreble added is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Mar 10, 2024
Copy link
Contributor

@Ixrec Ixrec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, but I don't know LttP logic enough to meaningfully test this.

IMO it's worth stating explicitly that this does change behavior, but in a way that hopefully fixes undiscovered bugs. In particular, option in stringset always returns False, so some of this code is dead on main but brought back to life by this PR; so we want to ask the world maintainer how safe it is to revive this dead code and how well-tested these cases are. (I see their review's already been requested)

@Ixrec
Copy link
Contributor

Ixrec commented Mar 10, 2024

>       if logic.current_key in {'overworld_glitches', 'hybrid_major_glitches', 'no_logic'} and world.glitch_boots[player]:
E       AttributeError: 'str' object has no attribute 'current_key'

Hm

logic = world.glitches_required[player]

That option is a Choice. Is it possible current_key depends on the new options API somehow? I don't know how a Choice could end up lacking these properties only inside LttP.

@alwaysintreble
Copy link
Collaborator Author

>       if logic.current_key in {'overworld_glitches', 'hybrid_major_glitches', 'no_logic'} and world.glitch_boots[player]:
E       AttributeError: 'str' object has no attribute 'current_key'

Hm

logic = world.glitches_required[player]

That option is a Choice. Is it possible current_key depends on the new options API somehow? I don't know how a Choice could end up lacking these properties only inside LttP.

the unit tests were assigning a string instead of an option class to the option.

@Berserker66 Berserker66 merged commit 5fecb7f into ArchipelagoMW:main Mar 11, 2024
15 checks passed
EmilyV99 pushed a commit to EmilyV99/Archipelago that referenced this pull request Apr 15, 2024
EmilyV99 pushed a commit to EmilyV99/Archipelago that referenced this pull request Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants