mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-02-06 11:40:34 +01:00
fix item.c gotos
This commit is contained in:
parent
3b7f708eb0
commit
2cc38acb84
17
src/item.c
17
src/item.c
@ -280,10 +280,6 @@ bool8 AddBagItem(u16 itemId, u16 count)
|
|||||||
{
|
{
|
||||||
// successfully added to already existing item's count
|
// successfully added to already existing item's count
|
||||||
SetBagItemQuantity(&newItems[i].quantity, ownedCount + count);
|
SetBagItemQuantity(&newItems[i].quantity, ownedCount + count);
|
||||||
|
|
||||||
// goto SUCCESS_ADD_ITEM;
|
|
||||||
// is equivalent but won't match
|
|
||||||
|
|
||||||
memcpy(itemPocket->itemSlots, newItems, itemPocket->capacity * sizeof(struct ItemSlot));
|
memcpy(itemPocket->itemSlots, newItems, itemPocket->capacity * sizeof(struct ItemSlot));
|
||||||
Free(newItems);
|
Free(newItems);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -303,7 +299,7 @@ bool8 AddBagItem(u16 itemId, u16 count)
|
|||||||
// don't create another instance of the item if it's at max slot capacity and count is equal to 0
|
// don't create another instance of the item if it's at max slot capacity and count is equal to 0
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
goto SUCCESS_ADD_ITEM;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,7 +330,8 @@ bool8 AddBagItem(u16 itemId, u16 count)
|
|||||||
{
|
{
|
||||||
// created a new slot and added quantity
|
// created a new slot and added quantity
|
||||||
SetBagItemQuantity(&newItems[i].quantity, count);
|
SetBagItemQuantity(&newItems[i].quantity, count);
|
||||||
goto SUCCESS_ADD_ITEM;
|
count = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,11 +342,9 @@ bool8 AddBagItem(u16 itemId, u16 count)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
memcpy(itemPocket->itemSlots, newItems, itemPocket->capacity * sizeof(struct ItemSlot));
|
||||||
SUCCESS_ADD_ITEM:
|
Free(newItems);
|
||||||
memcpy(itemPocket->itemSlots, newItems, itemPocket->capacity * sizeof(struct ItemSlot));
|
return TRUE;
|
||||||
Free(newItems);
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user