 Rem File: Cmd156.bas
 Rem Sub: Zap.Room
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 156 -- Zap.Room."
    Color 7,0
    End
 Endif
 Call Zap.Room(TempX!)
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

Sub Zap.Room(Var1!)
 ON LOCAL ERROR GOTO Error.Trap72x
 If Var1!=SFalse Then
    VarX!=Room
 Else
    VarX!=Var1!
 Endif
 If VarX!>SFalse And VarX!<=Lof(RoomFile)/RoomRecLen Then
    Eat$=Nul
 Else
    Strng="Room number out of range."
    Call IO.O
    Exit Sub
 Endif

 Graphics.Off=True
 Strng="Zap room"+Str$(VarX!)+" directions(y/n/q)? "
 No.Input.Out="N"
 Call IO.I
 If Quit Then
    Exit Sub
 Endif
 If Yes Then
    For Var2=1 To 12
       RoomRecord.Direct(Var2)=SFalse
    Next
    Call Write.Record(RoomFile,VarX!)
    Strng="Room"+Str$(VarX!)+" directions zapped."
    Call IO.O
 Endif
 Graphics.Off=True
 Strng="Zap room"+Str$(VarX!)+" descriptions(y/n/q)? "
 No.Input.Out="N"
 Call IO.I
 If Quit Then
    Exit Sub
 Endif
 If Yes Then
    RoomRecord.ShortDesc=Nul
    For Var2=1 To 19
       RoomRecord.LongDesc(Var2)=SFalse
    Next
    Call Write.Record(RoomFile,VarX!)
    Strng="Room"+Str$(VarX!)+" descriptions zapped."
    Call IO.O
 Endif
 Graphics.Off=True
 Strng="Zap room"+Str$(VarX!)+" inventory(y/n/q)? "
 No.Input.Out="N"
 Call IO.I
 If Quit Then
    Exit Sub
 Endif
 If Yes Then
    Call Read.Record(RoomFile,VarX!)
    Temp5!=RoomRecord.First
    If Temp5! Then
       Do While Lost.Carrier=False
          Call Read.Record(RoomInvFile,Temp5!)
          If MessWorkRecord6.Room=SFalse Then
             Exit Do
          Endif
          Temp6!=MessWorkRecord6.Next
          If MessWorkRecord6.Index Then
             Call Delete.List.Node(Temp5!)
             Call Clear.List.Node
             Call Write.Record(RoomInvFile,Temp5!)
          Endif
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp5!=Temp6!
       Loop
    Endif
    RoomRecord.First=SFalse
    RoomRecord.Last=SFalse
    Call Write.Record(RoomFile,VarX!)
    Strng="Room"+Str$(VarX!)+" inventory zapped."
    Call IO.O
 Endif
 Graphics.Off=True
 Strng="Zap room"+Str$(VarX!)+" containers(y/n/q)? "
 No.Input.Out="N"
 Call IO.I
 If Quit Then
    Exit Sub
 Endif
 If Yes Then
    Call Read.Record(RoomFile,VarX!)
    Temp5!=RoomRecord.First2
    If Temp5! Then
       Do While Lost.Carrier=False
          Call Read.Record(ContainerFile,Temp5!)
          Temp6!=ContainerRecord.Next
          Call Delete.Room.Container(Temp5!)
          Call Clear.Container
          Call Write.Record(ContainerFile,Temp5!)
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp5!=Temp6!
       Loop
    Endif
    RoomRecord.First2=SFalse
    RoomRecord.Last2=SFalse
    Call Write.Record(RoomFile,VarX!)
    Strng="Room"+Str$(VarX!)+" containers zapped."
    Call IO.O
 Endif
Error.Resume72x:
 EXIT SUB
Error.Trap72x:
 RESUME Error.Resume72x
End Sub
