summaryrefslogtreecommitdiff
path: root/engine/items/inventory.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/items/inventory.asm')
-rw-r--r--engine/items/inventory.asm9
1 files changed, 5 insertions, 4 deletions
diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm
index d07f64eb..58bcf7e9 100644
--- a/engine/items/inventory.asm
+++ b/engine/items/inventory.asm
@@ -27,16 +27,17 @@ AddItemToInventory_:
ld a, [hli]
and a
jr z, .addNewItem
-.loop
+.notAtEndOfInventory
ld a, [hli]
ld b, a ; b = ID of current item in table
ld a, [wcf91] ; a = ID of item being added
cp b ; does the current item in the table match the item being added?
jp z, .increaseItemQuantity ; if so, increase the item's quantity
inc hl
+.loop
ld a, [hl]
- cp $ff ; is it the end of the table?
- jr nz, .loop
+ cp a, $ff ; is it the end of the table?
+ jr nz, .notAtEndOfInventory
.addNewItem ; add an item not yet in the inventory
pop hl
ld a, d
@@ -101,7 +102,7 @@ RemoveItemFromInventory_:
push hl
inc hl
ld a, [wWhichPokemon] ; index (within the inventory) of the item being removed
- sla a
+ add a
add l
ld l, a
jr nc, .noCarry