1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-01-30 23:00:18 -05:00

Fixed a lil' bug.

Should AddDTM be in the constructor of TMDTM?
Now you need to do AddDTM(mdtm) in the script?
This commit is contained in:
Niels 2010-05-19 19:40:07 +02:00
parent 9d59b3d6ee
commit 1eaac406b5
2 changed files with 7 additions and 8 deletions

View File

@ -34,8 +34,6 @@ type
{ TMDTM }
{ TMDTM }
TMDTM = class(TObject)
private
FPoints : TMDTMPointArray;
@ -51,6 +49,9 @@ type
property Count : integer read FLen write SetPointCount;
property Points : TMDTMPointArray read FPoints;
end;
{ TMDTMS }
TMDTMS = class(TObject) //Manages the DTMs TMufasaDTMs
private
Client: TObject;
@ -256,15 +257,12 @@ end;
function TMDTM.ToString: string;
begin
Result := '';
end;
function TMDTM.Valid: boolean;
begin
result := false;
if Count < 1 then
exit;
result := true;
Result := Count > 0;
end;
end.

View File

@ -127,6 +127,7 @@ function SDTMToMDTM(Const DTM: TSDTM): TMDTM;
var
I: Integer;
begin
Result := TMDTM.Create;
Result.Count := Length(DTM.SubPoints) + 1; //The mainpoint is in a different structure
Result.Points[0].x := DTM.MainPoint.x;
@ -152,7 +153,7 @@ procedure NormalizeDTM(var dtm: TMDTM);
var
i:integer;
begin
if (dtm.count < 1) or ((dtm.Points[0].x = 0) and (dtm.Points[0].y = 0)) then //Already normalized
if (dtm = nil) or (dtm.count < 1) or ((dtm.Points[0].x = 0) and (dtm.Points[0].y = 0)) then //Already normalized
exit;
for i := 1 to dtm.Count - 1 do
begin