Prev: 38660 Up: Map Next: 38693
38674: Remove object C from a character's inventory and tidy up remaining entries
Used by the routines at 30439, 30540, 30602, 30880, 32390, 33883, 33935 and 34062.
Input
B Number of inventory slots to check
C Index of object to be removed
HL Pointer to a character's current inventory
38674 LD A,(HL) Load A with inventory object
38675 CP C If this matches index in C...
38676 JR Z,38682 ...then skip ahead to 38682
38678 INC HL Advance to next inventory slot...
38679 DJNZ 38674 ...and repeat loop for next slot
38681 RET Return if object not found
38682 INC HL Advance to next inventory slot
38683 LD A,(HL) Load object at this slot into A
38684 DEC HL Move back to previous slot again
38685 LD (HL),A Place object from next slot into current one
38686 INC HL Advance to next slot again
38687 DJNZ 38682 Repeat for all remaining slots
38689 DEC HL Move back to previous slot (i.e. final slot for this character)...
38690 XOR A ...and set to empty...
38691 LD (HL),A ...
38692 RET Return
Prev: 38660 Up: Map Next: 38693