@@ -29,10 +29,10 @@ Enum representing the type of nodes in a `TWebGraph`.
2929 TGraphNode = record
3030 Node: TPoint;
3131 Typ: EGraphNode;
32- Handle: function (): Boolean;
32+ Handle: function (): Boolean of object ;
3333 end;
3434
35- function TGraphNode.Create(pt: TPoint; typ: EGraphNode = EGraphNode.NORMAL; handle: function (): Boolean = nil): TGraphNode; static;
35+ function TGraphNode.Create(pt: TPoint; typ: EGraphNode = EGraphNode.NORMAL; handle: function (): Boolean of object = nil): TGraphNode; static;
3636begin
3737 Result.Node := pt;
3838 Result.Typ := typ;
@@ -409,7 +409,7 @@ begin
409409end;
410410
411411
412- procedure TWebGraph.AddLink(a, b: TPoint; typ: EGraphNode; handle: function (): Boolean);
412+ procedure TWebGraph.AddLink(a, b: TPoint; typ: EGraphNode; handle: function (): Boolean of object );
413413var
414414 i, j, n: Integer;
415415 tpa: TPointArray;
@@ -447,7 +447,7 @@ begin
447447 end;
448448end;
449449
450- procedure TWebGraph.AddLink(a, b: TPoint; typ: EGraphNode; handleA, handleB: function (): Boolean); overload;
450+ procedure TWebGraph.AddLink(a, b: TPoint; typ: EGraphNode; handleA, handleB: function (): Boolean of object ); overload;
451451var
452452 i, j, n: Integer;
453453 tpa: TPointArray;
@@ -485,7 +485,7 @@ begin
485485 end;
486486end;
487487
488- procedure TWebGraph.AddLink(pt, a, b: TPoint; typ: EGraphNode; handle: function (): Boolean); overload;
488+ procedure TWebGraph.AddLink(pt, a, b: TPoint; typ: EGraphNode; handle: function (): Boolean of object ); overload;
489489var
490490 i, j, n: Integer;
491491 tpa: TPointArray;
@@ -521,13 +521,14 @@ begin
521521 Self.Nodes[i] := TGraphNode.Create(pt, typ, @handle);
522522end;
523523
524- procedure TWebGraph.AddTeleport(pt: TPoint; handle: function (): Boolean);
524+ procedure TWebGraph.AddTeleport(pt: TPoint; handle: function (): Boolean of object );
525525var
526526 i, j, n: Integer;
527527 tpa: TPointArray;
528528begin
529529 i := Length(Self.Nodes);
530530 Self.Nodes += [pt, EGraphNode.TELEPORT, @handle];
531+ SetLength(Self.Paths, Length(Self.Nodes));
531532
532533 tpa := Self.Tree.KNearest(pt, 12);
533534 for j := 0 to High(tpa) do
556557begin
557558 i := Length(Self.Nodes);
558559 Self.Nodes += [pt, EGraphNode.FAIRYRING, nil];
560+ SetLength(Self.Paths, Length(Self.Nodes));
559561
560562 tpa := Self.Tree.KNearest(pt, 8);
561563 for j := 0 to High(tpa) do
@@ -607,8 +609,10 @@ begin
607609
608610 img.DrawColor := $00EAEA;
609611 for i := 0 to High(Self.Paths) do
610- for j := 0 to High(Self.Paths[i]) do
611- img.DrawLine(Self.Nodes[i].Node, Self.Nodes[Self.Paths[i, j]].Node);
612+ if Self.Nodes[i].Typ <> EGraphNode.TELEPORT then
613+ for j := 0 to High(Self.Paths[i]) do
614+ if Self.Nodes[Self.Paths[i, j]].Typ <> EGraphNode.TELEPORT then
615+ img.DrawLine(Self.Nodes[i].Node, Self.Nodes[Self.Paths[i, j]].Node);
612616
613617 for i := 0 to High(Self.Nodes) do
614618 begin
@@ -631,11 +635,13 @@ begin
631635 if Self.Nodes = [] then Exit;
632636
633637 for i := 0 to High(Self.Paths) do
634- for j := 0 to High(Self.Paths[i]) do
635- begin
636- if Self.Paths[i, j] > High(Self.Nodes) then Continue;
637- canvas.DrawLine(Self.Nodes[i].Node, Self.Nodes[Self.Paths[i, j]].Node, $00EAEA);
638- end;
638+ if Self.Nodes[i].Typ <> EGraphNode.TELEPORT then
639+ for j := 0 to High(Self.Paths[i]) do
640+ if Self.Nodes[Self.Paths[i, j]].Typ <> EGraphNode.TELEPORT then
641+ begin
642+ if Self.Paths[i, j] > High(Self.Nodes) then Continue;
643+ canvas.DrawLine(Self.Nodes[i].Node, Self.Nodes[Self.Paths[i, j]].Node, $00EAEA);
644+ end;
639645
640646 for i := 0 to High(Self.Nodes) do
641647 begin
0 commit comments