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

Sub Reload.Object
 On Local Error Goto ErrTrap22
 Call Parse
 Call Numeric
 Temp4=False
 Call Check.Room.Items
 If Temp7!<SFalse Then
    Strng="You can't reload that!"
    Call IO.O
    Exit Sub
 Endif
 If Temp7!=SFalse Then
    Call Num
    Temp4=UnTrue
    Call Check.User.Items
 Endif
 If Temp7!<=SFalse Then
    Strng="You can't reload that!"
    Call IO.O
    Exit Sub
 Endif
 If TreasureRecord.Spell Then
    Call Read.Record(SpellFile,Temp4!)
    If SpellRecord.SpellType=4 Then
       Strng="You can't reload that!"
       Call IO.O
       Exit Sub
    Endif
 Endif
 Temp1=UserRecord.Magic
 If Temp1<=False Then
    Strng="You have no more magic points!"
    Call IO.O
    Exit Sub
 Endif
 If TreasureRecord.Spell Then
    Temp2=SpellRecord.Level
 Else
    Temp2=TreasureRecord.Plus
 Endif
 If Temp2*UserRecord.Level>MaxInt Then
    Var1=MaxInt
 Else
    Var1=Temp2*UserRecord.Level
 Endif
 If Temp6>=Var1 Then
    Strng="You can't reload any more!"
    Call IO.O
    Exit Sub
 Endif
 If Temp6+Temp1>Var1 Then
    UserRecord.Magic=Temp1-Var1+Temp6
    Temp6=Var1
 Else
    UserRecord.Magic=False
    Temp6=Temp6+Temp1
 Endif
 Select Case Temp4
 Case 1
    Call Read.Record(MessWorkFile6,Temp5!)
    MessWorkRecord6.Charges=Temp6
    Call Write.Record(MessWorkFile6,Temp5!)
 Case 0
    Call Read.Record(RoomInvFile,Temp5!)
    MessWorkRecord6.Charges=Temp6
    Call Write.Record(RoomInvFile,Temp5!)
 End Select
 Strng="You reloaded it!"
 Call IO.O
ErrResume22:
 Exit Sub
ErrTrap22:
 Resume ErrResume22
End Sub
