Prev: 86BA Up: Map Next: 86ED
86BC: Find the next candidate target
Searches for the next object (or room, if $B5EF is set) that fits the target's words, starting from where the last search left off ($833F). Only candidates for which the action would work are returned (86ED). Returns A=$FF when there are no more.
86BC PUSH IY Save the caller's IY
86BE LD IX,($833F) IX = where the target search last left off
86C2 LD A,($B5EF) Is the target actually meant to be a room?
86C5 DEC A
86C6 JR Z,$86E2 Yes: search rooms instead, below
86C8 LD IY,$9D2E No: IY = the object-search routine
86CC LD A,($B60E) A = the action's own filter (characters only, objects only, or anything)
86CF RRCA
86D0 RRCA
86D1 AND $03
86D3 LD ($B600),A
86D6 CALL $86ED Find the next candidate object for which the action would work
86D9 CP $FF
86DB LD ($833F),IX Remember where the search has got to
86DF POP IY Restore the caller's IY
86E1 RET
86E2 LD IY,$9DE9 Rooms: IY = the room-search routine instead
86E6 CALL $86ED Find the next candidate room for which the action would work
86E9 CP $FF
86EB JR $86DB
Prev: 86BA Up: Map Next: 86ED