C***  ATHAND .TRUE. IF OBJ READILY AVAILABLE


       LOGICAL FUNCTION ATHAND(OBJ)

C  ATHAND(OBJ)  = TRUE IF OBJ IS READILY REACHABLE.
C                 IT CAN BE LYING HERE, IN HAND OR IN OPEN CONTAINER.

       IMPLICIT INTEGER(A-Z)
       COMMON /LOCCOM/ LOC,OLDLOC,OLDLC2,NEWLOC,MAXLOC
       COMMON /PLACOM/ ATLOC(250),LINK(300),PLACE(150),
     1          FIXED(150),MAXOBJ
       LOGICAL TOTING,AJAR,ENCLSD,HOLDNG,AAA

       CONTNR=-PLACE(OBJ)
       AAA=ENCLSD(OBJ).AND.AJAR(CONTNR)

       ATHAND=PLACE(OBJ).EQ.LOC.OR.HOLDNG(OBJ).OR.
     1      (AAA.AND.
     2          (PLACE(CONTNR).EQ.LOC.OR.
     3          (TOTING(OBJ).AND.HOLDNG(CONTNR))))

       RETURN
       END
