 Rem File: Cmd031.bas
 Rem Sub: Close.Object
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 031 -- Close.Object."
    Color 7,0
    End
 Endif
 Call Close.Object
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

Sub Close.Object
 On Local Error Goto ErrTrap27
 Call Parse
 If Parser Then
    Call Numeric
 Endif
 Call Check.Room.Items
 If Temp7!>SFalse Then
    Strng="You can't close that!"
    Call IO.O
    Exit Sub
 Endif
 If Temp7!=SFalse Then
    Call Num
    Call Check.User.Items
    If Temp7!>SFalse Then
       Strng="You can't close that!"
       Call IO.O
       Exit Sub
    Endif
    If Temp7!=SFalse Then
       Call Num
       Call Examine.Containers
       If TempA! Then
          Call Close.Container
          Exit Sub
       Endif
    Endif
 Endif
 If Temp7!<SFalse Then
    Temp7!=Abs(Temp7!)
    If ObjectRecord.DoorLock<>1 Then
       Strng="You can't close that!"
       Call IO.O
       Exit Sub
    Endif
    If ObjectRecord.Closed Then
       Strng="It's already closed!"
       Call IO.O
       Exit Sub
    Endif
    ObjectRecord.Closed=True
    Call Write.Record(ObjectFile,Temp7!)
    Strng="You close it!"
    Call IO.O
    Exit Sub
 Endif
 Strng="You can't close that!"
 Call IO.O
ErrResume27:
 Exit Sub
ErrTrap27:
 Resume ErrResume27
End Sub

Sub Close.Container
 On Local Error Goto ErrTrap34
 If ContainerRecord.Damaged=True Then
    Strng="You can't, it's damaged!"
    Call IO.O
    Exit Sub
 Endif
 If ContainerRecord.Locked=True Then ' is locked
    Strng="You can't! It's locked!"
    Call IO.O
    Exit Sub
 Endif
 If ContainerRecord.Locked=False Then ' has no lock
    Strng="You can't close that!"
    Call IO.O
    Exit Sub
 Endif
 If ContainerRecord.Closed Then ' is closed
    Strng="It's already closed!"
    Call IO.O
    Exit Sub
 Endif
 ContainerRecord.Closed=True ' closed
 Call Write.Record(ContainerFile,TempA!)
 Strng="You close it!"
 Call IO.O
ErrResume34:
 Exit Sub
ErrTrap34:
 Resume ErrResume34
End Sub
