Changeset 34 for trunk


Ignore:
Timestamp:
Apr 19, 2015, 1:06:35 AM (10 years ago)
Author:
chronos
Message:
  • Modified: Change train direction if train is manually repositioned.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UEngine.pas

    r33 r34  
    15251525  TargetStationIndex: Integer;
    15261526  PosChange: Double;
     1527  TP: TTrackPoint;
    15271528begin
    15281529  // Move trains
     
    15301531  with TMetroTrain(Trains[I]) do begin
    15311532    if not Assigned(TargetStation) and Assigned(BaseTrackPoint) then begin
    1532       Direction := 1;
    1533       TargetStation := BaseTrackPoint.GetUp.LineStation;
     1533      if (Direction <> 1) and (Direction <> -1) then Direction := 1
     1534        else Direction := -Direction;
     1535      TP := BaseTrackPoint.GetUp;
     1536      if Assigned(TP) then TargetStation := TP.LineStation
     1537      else begin
     1538        TP := BaseTrackPoint.GetDown;
     1539        if Assigned(TP) then TargetStation := TP.LineStation;
     1540      end;
    15341541    end;
    15351542    if Assigned(Line) then begin
Note: See TracChangeset for help on using the changeset viewer.