@@ -13255,6 +13255,7 @@ public bool CreateStationStop(int platformStartID, int arrivalTime, int departTi
1325513255 false,
1325613256 false,
1325713257 false,
13258+ false,
1325813259 StationStop.STOPTYPE.STATION_STOP);
1325913260
1326013261 thisStation.arrivalDT = arrivalDT;
@@ -16065,6 +16066,7 @@ public StationStop CalculateStationStop(int platformStartID, int arrivalTime, in
1606516066 false,
1606616067 false,
1606716068 false,
16069+ false,
1606816070 StationStop.STOPTYPE.STATION_STOP);
1606916071
1607016072 thisStation.arrivalDT = arrivalDT;
@@ -20565,6 +20567,7 @@ public enum STOPTYPE
2056520567 public bool RestrictPlatformToSignal = false; // restrict end of platform to signal position
2056620568 public bool ExtendPlatformToSignal = false; // extend end of platform to next signal position
2056720569 public bool EndStop = false; // train terminates at station
20570+ public bool AllowDepartEarly = false; // train may depart early if boarding is completed
2056820571 public List<int> ConnectionsWaiting = new List<int>(); // List of trains waiting
2056920572 public Dictionary<int, int> ConnectionsAwaited = new Dictionary<int, int>(); // List of awaited trains : key = trainno., value = arr time
2057020573 public Dictionary<int, WaitInfo> ConnectionDetails = new Dictionary<int, WaitInfo>(); // Details of connection : key = trainno., value = wait info
@@ -20578,7 +20581,7 @@ public StationStop(int platformReference, PlatformDetails platformItem, int subr
2057820581 int tcSectionIndex, int direction, int exitSignal, bool holdSignal, bool noWaitSignal, bool noClaimAllowed, float stopOffset,
2057920582 int arrivalTime, int departTime, bool terminal, int? actualMinStopTime, float? keepClearFront, float? keepClearRear,
2058020583 bool forcePosition, bool closeupSignal, bool closeup,
20581- bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, STOPTYPE actualStopType)
20584+ bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, bool allowdepartearly, STOPTYPE actualStopType)
2058220585 {
2058320586 ActualStopType = actualStopType;
2058420587 PlatformReference = platformReference;
@@ -20618,6 +20621,7 @@ public StationStop(int platformReference, PlatformDetails platformItem, int subr
2061820621 RestrictPlatformToSignal = restrictPlatformToSignal;
2061920622 ExtendPlatformToSignal = extendPlatformToSignal;
2062020623 EndStop = endStop;
20624+ AllowDepartEarly = allowdepartearly;
2062120625
2062220626 CallOnAllowed = false;
2062320627 }
@@ -20732,6 +20736,7 @@ public StationStop(BinaryReader inf, Signals signalRef)
2073220736 RestrictPlatformToSignal = inf.ReadBoolean();
2073320737 ExtendPlatformToSignal = inf.ReadBoolean();
2073420738 EndStop = inf.ReadBoolean();
20739+ AllowDepartEarly = inf.ReadBoolean();
2073520740 }
2073620741
2073720742 //================================================================================================//
@@ -20855,6 +20860,7 @@ public void Save(BinaryWriter outf)
2085520860 outf.Write(RestrictPlatformToSignal);
2085620861 outf.Write(ExtendPlatformToSignal);
2085720862 outf.Write(EndStop);
20863+ outf.Write(AllowDepartEarly);
2085820864 }
2085920865
2086020866 /// <summary>
@@ -20877,6 +20883,20 @@ public int CalculateDepartTime(int presentTime, Train stoppedTrain)
2087720883 int eightHundredHours = 8 * 3600;
2087820884 int sixteenHundredHours = 16 * 3600;
2087920885
20886+ int stopTime = 0;
20887+
20888+ // allow to depart early if set (timetable mode only, so no need to check for valid schedule)
20889+ if (AllowDepartEarly)
20890+ {
20891+ stoppedTrain.ComputeTrainBoardingTime(this, ref stopTime);
20892+ ActualDepart = ActualArrival + stopTime;
20893+
20894+ // correct for times around midnight
20895+ if (ActualDepart > 24 * 3600) ActualDepart -= 24 * 3600;
20896+ if (DepartTime == 0) DepartTime = ActualDepart;
20897+ return stopTime;
20898+ }
20899+
2088020900 // preset depart to booked time
2088120901 ActualDepart = DepartTime;
2088220902
@@ -20891,7 +20911,8 @@ public int CalculateDepartTime(int presentTime, Train stoppedTrain)
2089120911 }
2089220912
2089320913 // correct stop time for stop around midnight
20894- int stopTime = DepartTime - ArrivalTime;
20914+ stopTime = DepartTime - ArrivalTime;
20915+
2089520916 if (DepartTime < eightHundredHours && ArrivalTime > sixteenHundredHours) // stop over midnight
2089620917 {
2089720918 stopTime += (24 * 3600);
0 commit comments