-
Notifications
You must be signed in to change notification settings - Fork 802
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
Restore packed item state when regenerating an item using heroitem data #6567
Conversation
Hang on, there are some potential issues I need to check into. Converting to draft. |
ca0f0d0
to
9b9cab5
Compare
9b9cab5
to
385f22f
Compare
In Diablo, if a packed item is regenerated for the wrong game, it's going to be a Hellfire item regenerated as a Diablo item. In this case, the regenerated item should be considered valid for Diablo because the erroneous data wouldn't include Hellfire-only base items or item powers. This could result in false positives (invalid items look valid), but cannot result in false negatives (valid items look invalid). In Hellfire, if a packed item is regenerated for the wrong game, it doesn't really matter. All items are considered valid in Hellfire so we still don't need to worry about false negatives. Since we don't need to worry about false negatives in either case, we don't need to worry about accidentally deleting valid items in To handle the false positive case, it would stand to reason that we should invoke I removed the code to adjust |
Actually, this assertion seems to be wrong. If you take a Diablo item to Hellfire, the idx gets adjusted and the item is repacked as a Hellfire item. If that item is ever returned to Diablo, it could end up being unpacked as a Hellfire item with Hellfire affixes. That could result in false negatives. This is easy to reproduce with Demonspike Coat. |
I decided the best way to deal with this was to eliminate the possibility of both false positives and false negatives. Demonspike Coat can now make the round-trip through Hellfire and back. This PR should be in good shape now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code (not the PR) is nightmare fule, lets hope it all goes well.
Mirrors the logic in
UnPackItem()
to restore and validate the values of fields that would have been restored during unpacking if the item didn't need to be regenerated inLoadHeroItems()
.devilutionX/Source/pack.cpp
Lines 405 to 411 in 49c5aea
This resolves #6561
Introduced in 1.5.1 (#6258)
Unrelated to #5580