Prev: 36104 Up: Map Next: 36273
36254: Remove object C from a character's inventory and tidy up remaining entries
Used by the routines at 29488, 29619, 29756, 31537 and 34265.
Input
B Number of inventory slots to check
C Index of object to be removed
HL Pointer to a character's current inventory
36254 LD A,(HL) Load A with inventory object
36255 CP C If this matches index in C...
36256 JR Z,36262 ...then skip ahead to 36262
36258 INC HL Advance to next inventory slot...
36259 DJNZ 36254 ...and loop back to 36254 for next slot
36261 RET Return if object not found
36262 INC HL Advance to next inventory slot
36263 LD A,(HL) Load object at this slot into A
36264 DEC HL Move back to previous slot again
36265 LD (HL),A Place object from next slot into current one
36266 INC HL Advance to next slot again
36267 DJNZ 36262 Loop back to 36262 (i.e. repeat for all remaining slots)
36269 DEC HL Move back to previous slot (i.e. final slot for this character)...
36270 XOR A ...and set to empty...
36271 LD (HL),A ...
36272 RET Return
Prev: 36104 Up: Map Next: 36273