Changeset 129


Ignore:
Timestamp:
May 1, 2023, 11:40:29 AM (19 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r127 r129  
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
    7   ExtCtrls, UEngine, LCLType, StdCtrls, types, UTranslator, UApplicationInfo,
     7  ExtCtrls, UEngine, LCLType, Types, UTranslator, UApplicationInfo,
    88  URegistry, UPersistentForm;
    99
  • trunk/UEngine.pas

    r128 r129  
    14531453  TempIntersect: TPoint;
    14541454begin
    1455   Result := TTrackLink.Create;
    1456   Result.Points.Count := 2;
    1457   Result.Points[0] := nil;
    1458   Result.Points[1] := nil;
     1455  Result := nil;
    14591456  I := 0;
    14601457  MinD := High(Integer);
     
    14661463      if (D < MinD) and (D < TrackClickDistance) then begin
    14671464        MinD := D;
    1468         Result.Points[0] := Track.Points[T - 1];
    1469         Result.Points[1] := Track.Points[T];
     1465        if not Assigned(Result) then
     1466          Result := TTrackLink.Create;
     1467        Result.Points.Add(Track.Points[T - 1]);
     1468        Result.Points.Add(Track.Points[T]);
    14701469        Intersect := TempIntersect;
    14711470      end;
     
    19461945  // Reset all trackpoints position shift
    19471946  for MetroLine in Lines do
    1948     for TrackPoint in MetroLine.Track.Points do
    1949       TrackPoint.Position := TrackPoint.PositionDesigned;
     1947    MetroLine.Track.Points.ResetToDesignatedPosition;
    19501948
    19511949  // Calculate new position shifts
     
    19821980          Points[I].PositionDesigned + Points[I].LinkDown.Shift,
    19831981          Points[I].PositionDesigned + Points[I].LinkUp.Shift,
    1984           Points[I + 1].PositionDesigned + Points[I].LinkUp.Shift, NewPoint) then begin
     1982          Points[I + 1].PositionDesigned + Points[I].LinkUp.Shift, NewPoint) then
     1983                  begin
    19851984            Points[I].Position := NewPoint;
    19861985          end else begin
     
    37063705      end;
    37073706
    3708       // New TrackLink creation from selected station as start
     3707      // New track creation from selected station as start
    37093708      Station := GetStationOnPos(View.PointDestToSrc(Position));
    37103709      if Assigned(Station) then begin
     
    40554054    FreeAndNil(Doc);
    40564055  end;
     4056  LastTickTime := Now;
    40574057end;
    40584058
  • trunk/UTrack.pas

    r128 r129  
    6464    class function GetClassSysName: string; override;
    6565    function CreateItem: TTrackPoint; override;
     66    procedure ResetToDesignatedPosition;
    6667  end;
    6768
     
    240241end;
    241242
     243procedure TTrackPoints.ResetToDesignatedPosition;
     244var
     245  I: Integer;
     246begin
     247  for I := 0 to Count - 1 do
     248    Items[I].Position := Items[I].PositionDesigned;
     249end;
     250
    242251{ TTrack }
    243252
Note: See TracChangeset for help on using the changeset viewer.