-
Notifications
You must be signed in to change notification settings - Fork 2
/
LemSteel.pas
88 lines (72 loc) · 1.73 KB
/
LemSteel.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{$include lem_directives.inc}
unit LemSteel;
(*--------------------------------------------------
Steel areas only exist for loading old levels!
This is ONLY for use in LemLVLLoader!
DO NOT USE IT ANYWHERE ELSE!!!
--------------------------------------------------*)
interface
uses
Contnrs, Classes,
LemPiece;
type
TSteelClass = class of TSteel;
TSteel = class(TSizedPiece)
public
fType : Byte;
end;
type
TSteels = class(TObjectList)
private
function GetItem(Index: Integer): TSteel;
public
constructor Create(aOwnsObjects: Boolean = True);
function Add(Item: TSteel): Integer; overload;
function Add: TSteel; overload;
procedure Insert(Index: Integer; Item: TSteel); overload;
function Insert(Index: Integer): TSteel; overload;
procedure Assign(aSrc: TSteels);
property Items[Index: Integer]: TSteel read GetItem; default;
property List;
end;
implementation
{ TSteels }
constructor TSteels.Create(aOwnsObjects: Boolean = True);
begin
inherited Create(aOwnsObjects);
end;
function TSteels.Add(Item: TSteel): Integer;
begin
Result := inherited Add(Item);
end;
function TSteels.Add: TSteel;
begin
Result := TSteel.Create;
inherited Add(Result);
end;
procedure TSteels.Insert(Index: Integer; Item: TSteel);
begin
inherited Insert(Index, Item);
end;
function TSteels.Insert(Index: Integer): TSteel;
begin
Result := TSteel.Create;
inherited Insert(Index, Result);
end;
procedure TSteels.Assign(aSrc: TSteels);
var
i: Integer;
Item: TSteel;
begin
Clear;
for i := 0 to aSrc.Count-1 do
begin
Item := Add;
Item.Assign(aSrc[i]);
end;
end;
function TSteels.GetItem(Index: Integer): TSteel;
begin
Result := inherited Get(Index);
end;
end.