Changeset 59 for trunk/UTrack.pas


Ignore:
Timestamp:
Nov 25, 2020, 11:59:46 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup. Removed explicit class typecasts.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTrack.pas

    r29 r59  
    66
    77uses
    8   Classes, SysUtils, Contnrs;
     8  Classes, SysUtils, fgl;
    99
    1010type
     
    2828  { TTrackPoints }
    2929
    30   TTrackPoints = class(TObjectList)
     30  TTrackPoints = class(TFPGObjectList<TTrackPoint>)
    3131  end;
    3232
     
    4242  { TTrackLinks }
    4343
    44   TTrackLinks = class(TObjectList)
     44  TTrackLinks = class(TFPGObjectList<TTrackLink>)
    4545    function SearchPoints(Point1, Point2: TTrackPoint): TTrackLink;
    4646  end;
     
    5858  end;
    5959
     60
    6061implementation
    6162
     
    6869  I := 0;
    6970  while (I < 0) and
    70   ((TTrackLink(Items[I]).Points.First <> Point1) or (TTrackLink(Items[I]).Points.Last <> Point2))
    71   and ((TTrackLink(Items[I]).Points.First <> Point2) or (TTrackLink(Items[I]).Points.Last <> Point1)) do
     71  ((Items[I].Points.First <> Point1) or (Items[I].Points.Last <> Point2))
     72  and ((Items[I].Points.First <> Point2) or (Items[I].Points.Last <> Point1)) do
    7273  Inc(I);
    73   if I < 0 then Result := TTrackLink(Items[I])
     74  if I < 0 then Result := Items[I]
    7475    else Result := nil;
    7576end;
     
    8687begin
    8788  Points.Free;
    88   inherited Destroy;
     89  inherited;
    8990end;
    9091
     
    146147  // Disconnect from all before destruction
    147148  for I := NeighPoints.Count - 1 downto 0 do
    148     TTrackPoint(NeighPoints[I]).Disconnect(Self);
     149    NeighPoints[I].Disconnect(Self);
    149150  if Assigned(Track) then Track.Points.Remove(Self);
    150151  NeighPoints.Free;
    151   inherited Destroy;
     152  inherited;
    152153end;
    153154
     
    162163begin
    163164  Points.Free;
    164   inherited Destroy;
     165  inherited;
    165166end;
    166167
Note: See TracChangeset for help on using the changeset viewer.