Skip to content

Compare custom enchantment payloads when matching inventory entries - #949

Closed
rancidone wants to merge 1 commit into
tiltedphoques:devfrom
rancidone:fix/inventory-enchantment-identity
Closed

rancidone wants to merge 1 commit into
tiltedphoques:devfrom
rancidone:fix/inventory-enchantment-identity

Conversation

@rancidone

Copy link
Copy Markdown

Inventory entries with the same base/enchantment IDs and scalar extra data currently compare equal even when their serialized custom enchantment effects differ. This lets CanBeMerged and AddOrRemoveEntry merge distinct payloads or remove the wrong variant, and hides those differences from inventory equality checks.

Include EnchantData in the existing extra-data comparison, comparing the weapon flag and every effect field. Add focused regressions for magnitude, area, duration, raw cost, effect ID, effect count and enchantment type, plus identical-payload merging/removal. Serialization and native hooks are unchanged.

Validation on Windows x64 with VS 2022, xmake 3.1.0, releasedbg, at commit 14710ce4b875a203feb3d3f5df29089ab252b6c4:

  • Complete TPTests suite: 8 test cases, 107 assertions passed.
  • Focused inventory tests: 2 test cases, 38 assertions passed.
  • In a disposable worktree, restoring only upstream Inventory.h made the same tests fail in all seven variant sections (7 failed assertions). Restoring the fix passed all 38 assertions again; tracked sources were clean afterward.

In-game custom-enchantment transfer has not been validated. This is a shared inventory value-comparison fix; it does not implement world-drop identity or pickup arbitration.

@rancidone

Copy link
Copy Markdown
Author

This code was generated by Codex. I apologize if this PR is premature, I didn't exactly ask it to open it and haven't reviewed the code. I am generating bug fixes while I play through with my wife relying on AI and correlated log analysis.

I am happy to make adjustments if necessary.

@miredirex

miredirex commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

I think there was a reason why EnchantData isn't included in the comparison check

In-game custom-enchantment transfer has not been validated

Next time please do some playtesting before submitting a PR. And tell your codex to adhere to our AGENTS.md

@rancidone rancidone closed this Nov 8, 2026
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.

2 participants