-
Notifications
You must be signed in to change notification settings - Fork 3
/
SimRun.pas
72 lines (59 loc) · 1.64 KB
/
SimRun.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
unit SimRun;
{$MODE Delphi}
interface
uses
LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons;
type
TfSimRun = class(TForm)
prbGames: TProgressBar;
panGameNbr: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
cmdStop: TBitBtn;
Label4: TLabel;
panSimTime: TPanel;
txtSimLog: TMemo;
panTurn: TPanel;
panGameTime: TPanel;
Label5: TLabel;
cmdAbortGame: TBitBtn;
procedure cmdStopClick(Sender: TObject);
procedure cmdAbortGameClick(Sender: TObject);
private
{ Private declarations }
public
procedure UpdateSimStats;
procedure SimLog(const sMsg: string);
end;
var
fSimRun: TfSimRun;
implementation
{$R *.lfm}
uses DateUtils, Globals;
procedure TfSimRun.cmdAbortGameClick(Sender: TObject);
begin
uSimStatus := ssAbort; // game status = aborted
bStopASAP := true; // abort current game
end;
procedure TfSimRun.cmdStopClick(Sender: TObject);
begin
uSimStatus := ssAbort; // game status = aborted
bSimAbort := true; // abort simulation
bStopASAP := true; // abort current game
end;
procedure TfSimRun.SimLog(const sMsg: string);
begin
txtSimLog.Lines.Add(FormatDateTime('hh:nn:ss',Now)+' '+sMsg);
end;
procedure TfSimRun.UpdateSimStats;
begin
panGameNbr.Caption := IntToStr(iSimCurr) + ' / ' + IntToStr(iSimGames);
prbGames.Position := iSimCompl;
panTurn.Caption := IntToStr(iTurnCounter);
panGameTime.Caption := FormatDateTime('hh:nn:ss',Now-dtSimGameTime);
panSimTime.Caption := FormatDateTime('hh:nn:ss',Now-dtSimStartTime);
Application.ProcessMessages;
end;
end.