diff options
| author | David Racine <bass_dr@hotmail.com> | 2026-08-05 00:03:12 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-05 04:03:12 +0000 |
| commit | 29c7e75688a03547ba8643ea444e2790a80cc14c (patch) | |
| tree | 6be2b258cb9ae4fd3fd8a59a87da63235b62b7d8 /StormLib/src/SFileListFile.cpp | |
| parent | 7be4a5941a2e7d6ce7a24e7a8a34d9cbd46e5bfb (diff) | |
Fix Gold Skulltula tokens overwriting the Bow inventory slot (#7021)
gItemSlots and sExtraItemBases only cover the item IDs that live in the
inventory, but Item_Give and Item_CheckObtainability index them with any
item ID. Reading past gItemSlots lands on gUpgradeShifts, so
INV_CONTENT(ITEM_SKULL_TOKEN) resolved to the Bow slot and stored the
token there, permanently corrupting the save.
Route both through a bounds-checked Item_GetSlot that reports SLOT_NONE
for items that have no slot, and skip the inventory store in that case.
That read is also undefined behaviour, which link-time optimization is
free to exploit: with it present clang dropped the ITEM_SKULL_TOKEN
branch and the ITEM_MEDALLION_WATER horse fixup from Item_Give
entirely, so tokens were never counted either.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'StormLib/src/SFileListFile.cpp')
0 files changed, 0 insertions, 0 deletions
