Prev: 44557 Up: Map Next: 44638
44588: Handler: Can Take Item
Used by the routines at Condition_CanTakeItem and Condition_CannotTakeItem.
Rejects a take when the item is already carried or the inventory is full.
Plural items in Table_PluralItems use the "them" message.
Input
A Item ID
Output
A 0 when the item can be taken, otherwise 1
F The zero flag is set when the item can be taken
Handler_CanTakeItem 44588 CALL CheckObjectInInventory Call CheckObjectInInventory.
44591 JR NZ,Handler_CanTakeItem_0 Jump to Handler_CanTakeItem_0 when it is not in the inventory.
Print "You're already carrying it.".
44593 LD HL,27 HL=Messaging_YoureAlreadyCarryingIt.
44596 LD BC,3 BC=0003.
Skip the plural-item search when the list length in C is zero.
44599 XOR A Jump to Handler_CanTakeItem_1 when the plural list is empty.
44600 OR C
44601 JR Z,Handler_CanTakeItem_1
44603 PUSH HL Stash HL on the stack.
44604 LD HL,46833 HL=Table_PluralItems.
44607 LD A,E A=E.
44608 CPIR Search the plural-item list.
44610 POP HL Restore HL from the stack.
44611 JR NZ,Handler_CanTakeItem_1 Jump to Handler_CanTakeItem_1 when this item is singular.
44613 INC HL Move HL on to the plural article string.
44614 JR Handler_CanTakeItem_1 Jump to Handler_CanTakeItem_1.
Print "You can't carry any more.".
Handler_CanTakeItem_0 44616 LD HL,31 HL=Messaging_YouCantCarryAnyMore.
44619 LD A,(41171) Jump to Handler_CanTakeItem_2 if *Count_InventoryItems is less than *CarryingLimit.
44622 LD B,A
44623 LD A,(41170)
44626 CP B
44627 JR C,Handler_CanTakeItem_2
Handler_CanTakeItem_1 44629 CALL PrintCompressedStringAndNewline Call PrintCompressedStringAndNewline.
44632 LD A,1 A=1.
44634 AND A The take is rejected.
44635 RET Return.
Handler_CanTakeItem_2 44636 XOR A A=0.
44637 RET Return.
Prev: 44557 Up: Map Next: 44638