-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathActivityFinder.pas
More file actions
88 lines (72 loc) · 1.7 KB
/
ActivityFinder.pas
File metadata and controls
88 lines (72 loc) · 1.7 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
unit ActivityFinder;
interface
uses Classes, SysUtils, Ogame_Types;
type
TActivity = class
private
ftime: int64;
fpos: TPlanetPosition;
public
property time: Int64 read ftime;
property pos: TPlanetPosition read fpos;
constructor Create(time: Int64; pos: TPlanetPosition);
end;
TActivityFinder = class
private
fname: string;
ftimes: TList;
function getTimes(index: integer): int64;
procedure clear;
public
property name: string read fname;
property times_u[index: integer]: int64 read getTimes;
procedure addActivity(time_u: int64; pos: TPlanetPosition);
function count: integer;
constructor Create(playerName: string);
destructor Destroy; override;
end;
implementation
uses DateUtils;
{ ActivityFinder }
procedure TActivityFinder.addActivity(time_u: int64; pos: TPlanetPosition);
var act: TActivity;
begin
act := TActivity.Create(time_u, pos);
ftimes.Add(act);
end;
procedure TActivityFinder.clear;
var i: integer;
begin
for i := 0 to ftimes.Count-1 do
begin
TActivity(ftimes[i]).Free;
end;
ftimes.Clear;
end;
function TActivityFinder.count: integer;
begin
Result := ftimes.Count;
end;
constructor TActivityFinder.Create(playerName: string);
begin
inherited Create();
fname := playerName;
end;
destructor TActivityFinder.Destroy;
begin
clear;
ftimes.Free;
inherited;
end;
function TActivityFinder.getTimes(index: integer): int64;
begin
result := TActivity(ftimes[index]).time;
end;
{ TActivity }
constructor TActivity.Create(time: Int64; pos: TPlanetPosition);
begin
inherited Create();
ftime := time;
fpos := pos;
end;
end.