Automatized the contents of some sideof in src/item.c

This commit is contained in:
LOuroboros 2022-08-31 22:56:39 -03:00
parent 0a2ac61b0f
commit e02b33ee11
1 changed files with 12 additions and 12 deletions

View File

@ -740,11 +740,11 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count)
u16 *items = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode];
u8 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode];
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++)
{
@ -792,8 +792,8 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count)
if (count == 0)
{
memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
Free(newItems);
Free(newQuantities);
return TRUE;
@ -823,11 +823,11 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count)
}
else
{
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
memcpy(newItems, items, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
memcpy(newQuantities, quantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++)
{
@ -854,8 +854,8 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count)
if (count == 0)
{
memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
memcpy(items, newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newItems));
memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));
Free(newItems);
Free(newQuantities);
return TRUE;