Prev: 48191 Up: Map Next: 48360
48341: Remove object C from a character's inventory and tidy up remaining entries
Used by the routines at 41748, 42036, 42157, 42395, 43636, 44635, 45149 and 45256.
Input
B Number of inventory slots to check
C Index of object to be removed
HL Pointer to a character's current inventory
48341 LD A,(HL) Load A with inventory object
48342 CP C If this matches index in C...
48343 JR Z,48349 ...then skip ahead to 48349
48345 INC HL Advance to next inventory slot...
48346 DJNZ 48341 ...and loop back to 48341 for next slot
48348 RET Return if object not found
48349 INC HL Advance to next inventory slot
48350 LD A,(HL) Load object at this slot into A
48351 DEC HL Move back to previous slot again
48352 LD (HL),A Place object from next slot into current one
48353 INC HL Advance to next slot again
48354 DJNZ 48349 Loop back to 48349 (i.e. repeat for all remaining slots)
48356 DEC HL Move back to previous slot (i.e. final slot for this character)...
48357 XOR A ...and set to empty...
48358 LD (HL),A ...
48359 RET Return
Prev: 48191 Up: Map Next: 48360