Files
Shipwright/soh
David Racine 29c7e75688 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>
2026-08-05 04:03:12 +00:00
..
2025-02-04 10:48:41 +01:00
2026-08-05 03:21:08 +00:00
2024-10-31 07:42:27 -07:00
2025-04-01 22:33:38 -04:00