This commit is contained in:
SiliconA-Z 2026-04-22 15:34:39 -04:00 committed by GitHub
commit f75f597517
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 21 deletions

View File

@ -58,7 +58,7 @@ u16 BagGetItemIdByPocketPosition(u8 pocketId, u16 pocketPos);
u16 BagGetQuantityByPocketPosition(u8 pocketId, u16 pocketPos);
void CompactItemsInBagPocket(struct BagPocket *bagPocket);
void SortBerriesOrTMHMs(struct BagPocket *bagPocket);
void MoveItemSlotInList(struct ItemSlot *itemSlots_, u32 from, u32 to_);
void MoveItemSlotInList(struct ItemSlot *itemSlots, u32 from, u32 to);
void ClearBag(void);
u16 CountTotalItemQuantityInBag(u16 itemId);
bool8 AddPyramidBagItem(u16 itemId, u16 count);

View File

@ -632,30 +632,29 @@ void SortBerriesOrTMHMs(struct BagPocket *bagPocket)
}
}
void MoveItemSlotInList(struct ItemSlot *itemSlots_, u32 from, u32 to_)
void MoveItemSlotInList(struct ItemSlot *itemSlots, u32 from, u32 to)
{
// dumb assignments needed to match
struct ItemSlot *itemSlots = itemSlots_;
u32 to = to_;
struct ItemSlot firstSlot;
s16 i;
if (from != to)
if (from == to)
return;
firstSlot = itemSlots[from];
if (to > from)
{
s16 i, count;
struct ItemSlot firstSlot = itemSlots[from];
if (to > from)
{
to--;
for (i = from, count = to; i < count; i++)
itemSlots[i] = itemSlots[i + 1];
}
else
{
for (i = from, count = to; i > count; i--)
itemSlots[i] = itemSlots[i - 1];
}
itemSlots[to] = firstSlot;
to--;
for (i = (s16)from; i < (s16)to; i++)
itemSlots[i] = itemSlots[i + 1];
}
else
{
for (i = (s16)from; i > (s16)to; i--)
itemSlots[i] = itemSlots[i - 1];
}
itemSlots[to] = firstSlot;
}
void ClearBag(void)