mirror of https://github.com/pret/pokeemerald.git
Merge pull request #1759 from LOuroboros/pyramidSchemes
Automatized the contents of some sideof in src/item.c
This commit is contained in:
commit
b66de1f056
24
src/item.c
24
src/item.c
|
@ -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(*items));
|
||||
memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*quantities));
|
||||
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(*items));
|
||||
memcpy(quantities, newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(*quantities));
|
||||
Free(newItems);
|
||||
Free(newQuantities);
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in New Issue