Changeset 107


Ignore:
Timestamp:
Oct 4, 2022, 3:53:47 PM (19 months ago)
Author:
chronos
Message:
  • Fixed: Initial view resize on new game.
  • Fixed: Wrong train drawing position if track points distance close to zero.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/UEngine.pas

    r106 r107  
    190190    GrabbedTrainDirection: Integer;
    191191    function GetServedDaysCount: Integer;
    192     procedure ResizeView;
     192    procedure ResizeView(Force: Boolean);
    193193    function GetExistStationShapes: TStationShapeSet;
    194194    function GetStationOnPos(Pos: TPoint): TMapStation;
     
    325325  MaxPassengersOveloadTime = 2;
    326326  MetroLineThickness = 13;
    327   TrackClickDistance = 10;
     327  TrackClickDistance = 15;
    328328  EndStationLength = 50;
    329329  ShowDistances = False;
     
    10341034
    10351035// Need to see all stations on screen
    1036 procedure TEngine.ResizeView;
     1036procedure TEngine.ResizeView(Force: Boolean);
    10371037var
    10381038  NewPoint: TPoint;
     
    10541054  Intersected := NewView.SourceRect;
    10551055  Intersected.Union(View.SourceRect);
    1056   if Intersected = View.SourceRect then Exit;
     1056  if not Force and (Intersected = View.SourceRect) then Exit;
    10571057
    10581058  View.Assign(NewView);
     
    28242824      LastNewStationTime := Time;
    28252825      Stations.AddNew;
    2826       ResizeView;
     2826      ResizeView(False);
    28272827      Redraw;
    28282828    end;
     
    32133213    if Key = KeyF6 then begin
    32143214      Stations.AddNew;
    3215       ResizeView;
     3215      ResizeView(False);
    32163216      Redraw;
    32173217    end else
     
    32833283  end;
    32843284
    3285   ResizeView;
     3285  ResizeView(True);
    32863286
    32873287  SelectedLine := nil;
  • trunk/UTrack.pas

    r106 r107  
    130130    UpPoint := BaseTrackPoint.GetNeighUp;
    131131    if Assigned(UpPoint) then begin
     132      Result.Direction := SubPoint(UpPoint.Position, Position);
    132133      D := Distance(UpPoint.Position, Position);
    133134      if D > 0 then begin
    134         Result.Direction := SubPoint(UpPoint.Position, Position);
    135135        Result.Position := Point(Trunc(Position.X + Result.Direction.X * RelPos / D),
    136136          Trunc(Position.Y + Result.Direction.Y * RelPos / D));
     137      end else begin
     138        Result.Position := Position;
    137139      end;
    138140    end;
Note: See TracChangeset for help on using the changeset viewer.