We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17f500f commit 6010d89Copy full SHA for 6010d89
engine/inventory.asm
@@ -642,6 +642,26 @@ inv_add_item: ; A: item index
642
lda (ZP_PTR_1),y
643
adc __inv_quant+1
644
sta (ZP_PTR_1),y
645
+ bvs @max ; reset to maximum value if overflow
646
+ ldy #(INV_ITEM_MAX+1)
647
+ cmp (ZP_PTR_1),y
648
+ bmi @check_inv_ctrl
649
+ bne @max
650
+ ldy #INV_ITEM_QUANT
651
+ lda (ZP_PTR_1),y
652
+ ldy #INV_ITEM_MAX
653
654
655
+@max:
656
657
658
659
+ sta (ZP_PTR_1),y
660
661
662
+ ldy #(INV_ITEM_QUANT+1)
663
664
+@check_inv_ctrl:
665
ldx #0
666
@loop:
667
cpx __inv_num_items
0 commit comments