diff options
author | Kurausukun <lord.uber1@gmail.com> | 2021-05-09 01:27:28 -0400 |
---|---|---|
committer | huderlem <huderlem@gmail.com> | 2021-05-13 11:29:11 -0500 |
commit | 2cc38acb8443c2c3b7da8d1e86482d25315a9880 (patch) | |
tree | b325afc8b43acdd9cc5cf968a8b99bba539160b0 /src | |
parent | 3b7f708eb01b90e6adbf34245297a6188014acb9 (diff) |
fix item.c gotos
Diffstat (limited to 'src')
-rw-r--r-- | src/item.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/item.c b/src/item.c index cc9a09ee0..68907b02c 100644 --- a/src/item.c +++ b/src/item.c @@ -280,10 +280,6 @@ bool8 AddBagItem(u16 itemId, u16 count) { // successfully added to already existing item's 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)); Free(newItems); 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 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 SetBagItemQuantity(&newItems[i].quantity, count); - goto SUCCESS_ADD_ITEM; + count = 0; + break; } } } @@ -345,11 +342,9 @@ bool8 AddBagItem(u16 itemId, u16 count) return FALSE; } } - - SUCCESS_ADD_ITEM: - memcpy(itemPocket->itemSlots, newItems, itemPocket->capacity * sizeof(struct ItemSlot)); - Free(newItems); - return TRUE; + memcpy(itemPocket->itemSlots, newItems, itemPocket->capacity * sizeof(struct ItemSlot)); + Free(newItems); + return TRUE; } } |