Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Procedure ResetVyhernosti;
Begin
  {Limit 65535 WORD}
 
  DatRec.Nahoda[0]:=8000;  {RollSetup bet 2, cim mensi tim min vyher}
  DatRec.Nahoda[1]:=25000; {RollSetup bet 4, cim mensi tim min vyher}
  DatRec.Nahoda[2]:=20000; {RollSetup bet 5, cim mensi tim min vyher}
 
  DatRec.Nahoda[3]:=18000; {TestWin bet 2J, cim mensi tim vic vyher}
  DatRec.Nahoda[4]:=47000; {TestWin bet 2J, cim mensi tim min vyher}
 
  DatRec.Nahoda[5]:=24000; {TestWin bet 4J, cim mensi tim vic vyher}
  DatRec.Nahoda[6]:=40000; {TestWin bet 4J, cim mensi tim min vyher}
 
  DatRec.Nahoda[7]:=48000; {TestWin bet 5J, cim mensi tim min vyher}
 
  DatRec.Nahoda[8]:=34000; {Risking vyhernost cim mensi tim min vyher}
End;
 
 
Procedure SaveLoad(Save: Boolean);
Var I: Byte;
Begin
  FindFirst('gambler.dat',Archive,DirInfo);
  Case DosError Of
  0: Begin {OK -> LOAD or SAVE}
       Assign(F,'gambler.dat');
       If Save=True then Begin {SAVE}
                           ReWrite(F,1);
                           BlockWrite(F,DatRec,SizeOf(DatRec));
                         End
                    else Begin {LOAD}
                           Reset(F,1);
                           BlockRead(F,DatRec,SizeOf(DatRec))
                         End;
       Close(F);
     End;
 18: Begin {Not found -> Create new}
       Assign(F,'gambler.dat');
       ReWrite(F,1);
 
       DatRec.fpsProdleva:=15;
       DatRec.RollSpeed:=1;
       DatRec.RawEnable:=True;
       DatRec.HiScore:=0;
       DatRec.Pub.Vklady:=0;
       DatRec.Pub.Vyplaceno:=0;
       DatRec.SBEnable:=True;
       DatRec.PS3:=True;
       DatRec.Hotovost:=0;
       For I:=0 to 13 do Begin
                           DatRec.vec[I]:=True;
                           VecProdata[I]:=False;
                         End;
       ResetVyhernosti;
       DatRec.NahodnyRisk:=True;
       BlockWrite(F,DatRec,SizeOf(DatRec));
       Close(F);
     End;
  End; {Case End}
End;
 
 
Procedure SaveLoadHistorie(Save: Boolean);
Var I: Byte;
Begin
  FindFirst('gambler.sav',Archive,DirInfo);
  Case DosError Of
  0: Begin {OK -> LOAD or SAVE}
       Assign(F,'gambler.sav');
       If Save=True then Begin {SAVE}
                           ReWrite(F,1);
                           BlockWrite(F,DatRec2,SizeOf(DatRec2));
                         End
                    else Begin {LOAD}
                           Reset(F,1);
                           BlockRead(F,DatRec2,SizeOf(DatRec2))
                         End;
       Close(F);
     End;
 18: Begin {Not found -> Create new}
       Assign(F,'gambler.sav');
       ReWrite(F,1);
       For I:=0 to MaxHistorie do Begin
                                    DatRec2.Vklad[I]:=0;
                                    DatRec2.Vyplaceno[I]:=0;
                                  End;
       DatRec2.JackPot:=0;
       DatRec2.JackPotCounter:=9;
       BlockWrite(F,DatRec2,SizeOf(DatRec2));
       Close(F);
     End;
  End; {Case End}
End;