mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-16 22:35:05 -05:00
Merge branch 'master' of ssh://villavu.com:54367/simba
This commit is contained in:
commit
e4fe1fae56
@ -37,7 +37,7 @@ type
|
|||||||
TMDTM = class(TObject)
|
TMDTM = class(TObject)
|
||||||
private
|
private
|
||||||
Client: TObject;
|
Client: TObject;
|
||||||
DTMList: Array Of pDTM;
|
DTMList: Array Of PpDTM;
|
||||||
FreeSpots: Array Of Integer;
|
FreeSpots: Array Of Integer;
|
||||||
procedure CheckIndex(index : integer);
|
procedure CheckIndex(index : integer);
|
||||||
public
|
public
|
||||||
@ -90,8 +90,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
if not b then
|
if not b then
|
||||||
begin;
|
begin;
|
||||||
if DTMList[i].n <> '' then
|
if DTMList[i]^.n <> '' then
|
||||||
WriteStr := WriteStr + DTMList[i].n + ', '
|
WriteStr := WriteStr + DTMList[i]^.n + ', '
|
||||||
else
|
else
|
||||||
WriteStr := WriteStr + inttostr(i) + ', ';
|
WriteStr := WriteStr + inttostr(i) + ', ';
|
||||||
FreeDTM(i);
|
FreeDTM(i);
|
||||||
@ -171,7 +171,7 @@ end;
|
|||||||
|
|
||||||
procedure TMDTM.CheckIndex(index: integer);
|
procedure TMDTM.CheckIndex(index: integer);
|
||||||
begin
|
begin
|
||||||
if (index < 0) or (index >= Length(DTMList)) then
|
if (index < 0) or (index >= Length(DTMList)) or (DTMList[Index] = nil) then
|
||||||
raise Exception.CreateFmt('The given DTM Index[%d] doesn''t exist',[index]);
|
raise Exception.CreateFmt('The given DTM Index[%d] doesn''t exist',[index]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -185,20 +185,24 @@ end;
|
|||||||
/\}
|
/\}
|
||||||
|
|
||||||
function TMDTM.AddpDTM(const d: pDTM): Integer;
|
function TMDTM.AddpDTM(const d: pDTM): Integer;
|
||||||
|
var
|
||||||
|
NewDTM : PpDTM;
|
||||||
begin
|
begin
|
||||||
|
New(NewDTM);
|
||||||
|
NewDTM^ := d;
|
||||||
|
|
||||||
if Length(FreeSpots) > 0 then
|
if Length(FreeSpots) > 0 then
|
||||||
begin
|
begin
|
||||||
DTMList[FreeSpots[High(FreeSpots)]] := d;
|
|
||||||
Result := FreeSpots[High(FreeSpots)];
|
Result := FreeSpots[High(FreeSpots)];
|
||||||
SetLength(FreeSpots, High(FreeSpots));
|
SetLength(FreeSpots, High(FreeSpots));
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
SetLength(DTMList, Length(DTMList) + 1);
|
SetLength(DTMList, Length(DTMList) + 1);
|
||||||
DTMList[High(DTMList)] := d;
|
|
||||||
Result := High(DTMList);
|
Result := High(DTMList);
|
||||||
end;
|
end;
|
||||||
NormalizeDTM(DTMList[result]);
|
DTMList[Result] := NewDTM;
|
||||||
|
NormalizeDTM(DTMList[result]^);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{/\
|
{/\
|
||||||
@ -209,13 +213,13 @@ end;
|
|||||||
function TMDTM.GetDTM(index: Integer) :pDTM;
|
function TMDTM.GetDTM(index: Integer) :pDTM;
|
||||||
begin
|
begin
|
||||||
CheckIndex(index);
|
CheckIndex(index);
|
||||||
result := DTMList[index];
|
result := DTMList[index]^;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMDTM.SetDTMName(DTM: Integer;const s: string);
|
procedure TMDTM.SetDTMName(DTM: Integer;const s: string);
|
||||||
begin
|
begin
|
||||||
CheckIndex(DTM);
|
CheckIndex(DTM);
|
||||||
DTMList[DTM].n := s;
|
DTMList[DTM]^.n := s;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{/\
|
{/\
|
||||||
@ -227,14 +231,19 @@ end;
|
|||||||
procedure TMDTM.FreeDTM(DTM: Integer);
|
procedure TMDTM.FreeDTM(DTM: Integer);
|
||||||
begin
|
begin
|
||||||
CheckIndex(DTM);
|
CheckIndex(DTM);
|
||||||
SetLength(DTMList[DTM].p, 0);
|
with DTMList[DTM]^ do
|
||||||
SetLength(DTMList[DTM].c, 0);
|
begin
|
||||||
SetLength(DTMList[DTM].t, 0);
|
SetLength(p, 0);
|
||||||
SetLength(DTMList[DTM].asz, 0);
|
SetLength(c, 0);
|
||||||
SetLength(DTMList[DTM].ash, 0);
|
SetLength(t, 0);
|
||||||
SetLength(DTMList[DTM].bp,0);
|
SetLength(asz, 0);
|
||||||
DTMList[DTM].l := 0;
|
SetLength(ash, 0);
|
||||||
DTMList[DTM].n := '';
|
SetLength(bp,0);
|
||||||
|
l := 0;
|
||||||
|
n := '';
|
||||||
|
end;
|
||||||
|
Dispose(DTMList[DTM]);
|
||||||
|
DTMList[DTM] := nil;
|
||||||
SetLength(FreeSpots, Length(FreeSpots) + 1);
|
SetLength(FreeSpots, Length(FreeSpots) + 1);
|
||||||
FreeSpots[High(FreeSpots)] := DTM;
|
FreeSpots[High(FreeSpots)] := DTM;
|
||||||
end;
|
end;
|
||||||
|
@ -118,6 +118,9 @@ type
|
|||||||
n: String; // DOEN
|
n: String; // DOEN
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
PpDTM = ^pDTM;
|
||||||
|
|
||||||
|
|
||||||
{ Other DTM Types }
|
{ Other DTM Types }
|
||||||
|
|
||||||
TDTMPointDef = record
|
TDTMPointDef = record
|
||||||
|
Loading…
Reference in New Issue
Block a user