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

Fix plLocation equality/comparison operators being inconsistent with each other #302

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dgelessus
Copy link
Contributor

@dgelessus dgelessus commented Mar 2, 2025

In the current code, the ==, !=, and < operators for plLocation all look at different combinations of fields. In particular, == doesn't look at fFlags even though != does, and < doesn't look at fFlags or fState. This PR makes all three operators consistent with each other.

These buggy implementations led to some bad behavior when editing a PRP's flags in PrpShop, which seems to be fixed with this PR. This hopefully fixes the problems that @TheScarFr had when trying to change a PRP from reserved to non-reserved (I'm not completely sure, because I couldn't reproduce the bug exactly).

Apparently the buggy code has been this way for over 15 years? This seems really bad! I'm surprised that this hasn't caused any other problems with PRP edits before.

While I was here, I also replaced all operator!= implementations with return !operator==(other); to prevent any future inconsistencies between == and !=, and added operator!= overloads to classes that only defined operator==.

Fixes some odd behavior in PrpShop when changing a PRP file's flags.
Most likely this also caused other weirdness besides that.
To prevent any future inconsistencies between the two.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant