Skip to content

Commit ee861f3

Browse files
committed
Automatic merge of T1.5.1-687-gd279e384a and 20 pull requests
- Pull request #570 at c59c788: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #865 at 67014b7: Dispatcher window improvements - Pull request #874 at f8dbeab: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #878 at f9aa2ad: Implement Polach Adhesion - Pull request #882 at d8a1c4d: Blueprint/train car operations UI window - Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling - Pull request #885 at c81447b: feat: Add notifications to Menu - Pull request #886 at 82fde3f: Scene viewer extension to TrackViewer - Pull request #887 at 4665bda: docs: Document projects, assemblies, namespaces - Pull request #888 at d7daf62: docs: Document player application model - Pull request #889 at 43341cf: No speed update - Pull request #890 at 39a9fa4: Allow depart early - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #893 at bf8876b: Signal errors - Pull request #894 at 794fddf: Correct Decrease Colour - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 64a29c8: feat: Improved system information collection
22 parents 4727763 + d279e38 + c59c788 + d00beb9 + 67014b7 + f8dbeab + 43bf33e + f92de76 + f9aa2ad + d8a1c4d + edcc2dd + c81447b + 82fde3f + 4665bda + d7daf62 + 43341cf + 39a9fa4 + 1f5ba4c + bf8876b + 794fddf + 5866028 + 64a29c8 commit ee861f3

File tree

4 files changed

+68
-15
lines changed

4 files changed

+68
-15
lines changed

Source/Orts.Simulation/Simulation/Physics/Train.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13264,6 +13264,7 @@ public bool CreateStationStop(int platformStartID, int arrivalTime, int departTi
1326413264
false,
1326513265
false,
1326613266
false,
13267+
false,
1326713268
StationStop.STOPTYPE.STATION_STOP);
1326813269

1326913270
thisStation.arrivalDT = arrivalDT;
@@ -16074,6 +16075,7 @@ public StationStop CalculateStationStop(int platformStartID, int arrivalTime, in
1607416075
false,
1607516076
false,
1607616077
false,
16078+
false,
1607716079
StationStop.STOPTYPE.STATION_STOP);
1607816080

1607916081
thisStation.arrivalDT = arrivalDT;
@@ -20574,6 +20576,7 @@ public enum STOPTYPE
2057420576
public bool RestrictPlatformToSignal = false; // restrict end of platform to signal position
2057520577
public bool ExtendPlatformToSignal = false; // extend end of platform to next signal position
2057620578
public bool EndStop = false; // train terminates at station
20579+
public bool AllowDepartEarly = false; // train may depart early if boarding is completed
2057720580
public List<int> ConnectionsWaiting = new List<int>(); // List of trains waiting
2057820581
public Dictionary<int, int> ConnectionsAwaited = new Dictionary<int, int>(); // List of awaited trains : key = trainno., value = arr time
2057920582
public Dictionary<int, WaitInfo> ConnectionDetails = new Dictionary<int, WaitInfo>(); // Details of connection : key = trainno., value = wait info
@@ -20587,7 +20590,7 @@ public StationStop(int platformReference, PlatformDetails platformItem, int subr
2058720590
int tcSectionIndex, int direction, int exitSignal, bool holdSignal, bool noWaitSignal, bool noClaimAllowed, float stopOffset,
2058820591
int arrivalTime, int departTime, bool terminal, int? actualMinStopTime, float? keepClearFront, float? keepClearRear,
2058920592
bool forcePosition, bool closeupSignal, bool closeup,
20590-
bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, STOPTYPE actualStopType)
20593+
bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, bool allowdepartearly, STOPTYPE actualStopType)
2059120594
{
2059220595
ActualStopType = actualStopType;
2059320596
PlatformReference = platformReference;
@@ -20627,6 +20630,7 @@ public StationStop(int platformReference, PlatformDetails platformItem, int subr
2062720630
RestrictPlatformToSignal = restrictPlatformToSignal;
2062820631
ExtendPlatformToSignal = extendPlatformToSignal;
2062920632
EndStop = endStop;
20633+
AllowDepartEarly = allowdepartearly;
2063020634

2063120635
CallOnAllowed = false;
2063220636
}
@@ -20741,6 +20745,7 @@ public StationStop(BinaryReader inf, Signals signalRef)
2074120745
RestrictPlatformToSignal = inf.ReadBoolean();
2074220746
ExtendPlatformToSignal = inf.ReadBoolean();
2074320747
EndStop = inf.ReadBoolean();
20748+
AllowDepartEarly = inf.ReadBoolean();
2074420749
}
2074520750

2074620751
//================================================================================================//
@@ -20864,6 +20869,7 @@ public void Save(BinaryWriter outf)
2086420869
outf.Write(RestrictPlatformToSignal);
2086520870
outf.Write(ExtendPlatformToSignal);
2086620871
outf.Write(EndStop);
20872+
outf.Write(AllowDepartEarly);
2086720873
}
2086820874

2086920875
/// <summary>
@@ -20886,6 +20892,20 @@ public int CalculateDepartTime(int presentTime, Train stoppedTrain)
2088620892
int eightHundredHours = 8 * 3600;
2088720893
int sixteenHundredHours = 16 * 3600;
2088820894

20895+
int stopTime = 0;
20896+
20897+
// allow to depart early if set (timetable mode only, so no need to check for valid schedule)
20898+
if (AllowDepartEarly)
20899+
{
20900+
stoppedTrain.ComputeTrainBoardingTime(this, ref stopTime);
20901+
ActualDepart = ActualArrival + stopTime;
20902+
20903+
// correct for times around midnight
20904+
if (ActualDepart > 24 * 3600) ActualDepart -= 24 * 3600;
20905+
if (DepartTime == 0) DepartTime = ActualDepart;
20906+
return stopTime;
20907+
}
20908+
2088920909
// preset depart to booked time
2089020910
ActualDepart = DepartTime;
2089120911

@@ -20900,7 +20920,8 @@ public int CalculateDepartTime(int presentTime, Train stoppedTrain)
2090020920
}
2090120921

2090220922
// correct stop time for stop around midnight
20903-
int stopTime = DepartTime - ArrivalTime;
20923+
stopTime = DepartTime - ArrivalTime;
20924+
2090420925
if (DepartTime < eightHundredHours && ArrivalTime > sixteenHundredHours) // stop over midnight
2090520926
{
2090620927
stopTime += (24 * 3600);

Source/Orts.Simulation/Simulation/Timetables/ProcessTimetable.cs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,6 +3160,7 @@ public enum SignalHoldType
31603160
public DateTime departureDT;
31613161
public DateTime passDT;
31623162
public bool arrdeppassvalid;
3163+
public bool allowDepartEarly;
31633164
public SignalHoldType holdState;
31643165
public bool noWaitSignal;
31653166
// TODO
@@ -3183,6 +3184,7 @@ public StopInfo(string name, string arrTime, string depTime, TimetableInfo ttinf
31833184
departureTime = -1;
31843185
passTime = -1;
31853186
Commands = null;
3187+
allowDepartEarly = false;
31863188

31873189
TimeSpan atime;
31883190
bool validArrTime = false;
@@ -3200,22 +3202,32 @@ public StopInfo(string name, string arrTime, string depTime, TimetableInfo ttinf
32003202
passDT = new DateTime(atime.Ticks);
32013203
}
32023204
}
3205+
if (arrTime.Contains("*"))
3206+
{
3207+
allowDepartEarly = true;
3208+
string arrivTime = arrTime.Replace('*', ':');
3209+
validArrTime = TimeSpan.TryParse(arrivTime, out atime);
3210+
if (validArrTime)
3211+
{
3212+
departureTime = arrivalTime = Convert.ToInt32(atime.TotalSeconds);
3213+
departureDT = arrivalDT = new DateTime(atime.Ticks);
3214+
}
3215+
}
32033216
else
32043217
{
3205-
32063218
validArrTime = TimeSpan.TryParse(arrTime, out atime);
32073219
if (validArrTime)
32083220
{
32093221
arrivalTime = Convert.ToInt32(atime.TotalSeconds);
32103222
arrivalDT = new DateTime(atime.Ticks);
32113223
}
3212-
}
32133224

3214-
validDepTime = TimeSpan.TryParse(depTime, out atime);
3215-
if (validDepTime)
3216-
{
3217-
departureTime = Convert.ToInt32(atime.TotalSeconds);
3218-
departureDT = new DateTime(atime.Ticks);
3225+
validDepTime = TimeSpan.TryParse(depTime, out atime);
3226+
if (validDepTime)
3227+
{
3228+
departureTime = Convert.ToInt32(atime.TotalSeconds);
3229+
departureDT = new DateTime(atime.Ticks);
3230+
}
32193231
}
32203232

32213233
arrdeppassvalid = validArrTime || validDepTime;
@@ -3394,7 +3406,7 @@ public bool BuildStopInfo(TTTrain actTrain, int actPlatformID, Signals signalRef
33943406

33953407
// Create station stop info
33963408
validStop = actTrain.CreateStationStop(actPlatformID, arrivalTime, departureTime, arrivalDT, departureDT, AITrain.clearingDistanceM,
3397-
AITrain.minStopDistanceM, terminal, actMinStopTime, keepClearFront, keepClearRear, forcePosition, closeupSignal, closeup, restrictPlatformToSignal, extendPlatformToSignal, endStop);
3409+
AITrain.minStopDistanceM, terminal, actMinStopTime,keepClearFront, keepClearRear, forcePosition, closeupSignal, closeup, restrictPlatformToSignal, extendPlatformToSignal, endStop, allowDepartEarly);
33983410

33993411
// Override holdstate using stop info - but only if exit signal is defined
34003412
int exitSignal = actTrain.StationStops[actTrain.StationStops.Count - 1].ExitSignal;

Source/Orts.Simulation/Simulation/Timetables/TTTrain.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ public override StationStop SetAlternativeStationStop(StationStop orgStop, TCSub
951951
StationStop newStop = CalculateStationStop(signalRef.PlatformDetailsList[altPlatformIndex].PlatformReference[0],
952952
orgStop.ArrivalTime, orgStop.DepartTime, orgStop.arrivalDT, orgStop.departureDT, clearingDistanceM, minStopDistanceM,
953953
orgStop.Terminal, orgStop.ActualMinStopTime, orgStop.KeepClearFront, orgStop.KeepClearRear, orgStop.ForcePosition,
954-
orgStop.CloseupSignal, orgStop.Closeup, orgStop.RestrictPlatformToSignal, orgStop.ExtendPlatformToSignal, orgStop.EndStop);
954+
orgStop.CloseupSignal, orgStop.Closeup, orgStop.RestrictPlatformToSignal, orgStop.ExtendPlatformToSignal, orgStop.EndStop, orgStop.AllowDepartEarly);
955955

956956
// Add new holding signal if required
957957
if (newStop.HoldSignal && newStop.ExitSignal >= 0)
@@ -1326,7 +1326,7 @@ public override bool PostInit()
13261326
/// <\summary>
13271327
public StationStop CalculateStationStop(int platformStartID, int arrivalTime, int departTime, DateTime arrivalDT, DateTime departureDT, float clearingDistanceM,
13281328
float minStopDistance, bool terminal, int? actMinStopTime, float? keepClearFront, float? keepClearRear, bool forcePosition, bool closeupSignal,
1329-
bool closeup, bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop)
1329+
bool closeup, bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, bool allowdepartearly)
13301330
{
13311331
int platformIndex;
13321332
int activeSubroute = 0;
@@ -1404,6 +1404,7 @@ public StationStop CalculateStationStop(int platformStartID, int arrivalTime, in
14041404
restrictPlatformToSignal,
14051405
extendPlatformToSignal,
14061406
endStop,
1407+
allowdepartearly,
14071408
StationStop.STOPTYPE.STATION_STOP)
14081409
{
14091410
arrivalDT = arrivalDT,
@@ -1997,11 +1998,11 @@ public StationStop CalculateStationStopPosition(TCSubpathRoute thisRoute, int ro
19971998
/// <returns></returns>
19981999
public bool CreateStationStop(int platformStartID, int arrivalTime, int departTime, DateTime arrivalDT, DateTime departureDT, float clearingDistanceM,
19992000
float minStopDistanceM, bool terminal, int? actMinStopTime, float? keepClearFront, float? keepClearRear, bool forcePosition, bool closeupSignal,
2000-
bool closeup, bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop)
2001+
bool closeup, bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, bool allowdepartearly)
20012002
{
20022003
StationStop thisStation = CalculateStationStop(platformStartID, arrivalTime, departTime, arrivalDT, departureDT, clearingDistanceM,
20032004
minStopDistanceM, terminal, actMinStopTime, keepClearFront, keepClearRear, forcePosition, closeupSignal, closeup,
2004-
restrictPlatformToSignal, extendPlatformToSignal, endStop);
2005+
restrictPlatformToSignal, extendPlatformToSignal, endStop, allowdepartearly);
20052006

20062007
if (thisStation != null)
20072008
{
@@ -10391,7 +10392,14 @@ public override void CheckStationTask()
1039110392
if (!StationStops[0].EndStop)
1039210393
{
1039310394
if (!DriverOnlyOperation) Simulator.SoundNotify = Event.PermissionToDepart; // Sound departure if not doo
10394-
DisplayMessage = Simulator.Catalog.GetString("Passenger boarding completed. You may depart now.");
10395+
if (StationStops[0].AllowDepartEarly)
10396+
{
10397+
DisplayMessage = Simulator.Catalog.GetString("Passenger boarding completed. Early departure allowed.");
10398+
}
10399+
else
10400+
{
10401+
DisplayMessage = Simulator.Catalog.GetString("Passenger boarding completed. You may depart now.");
10402+
}
1039510403
}
1039610404
}
1039710405
}

Source/RunActivity/Viewer3D/Popups/NextStationWindow.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
270270
StationPreviousArriveActual.Color = actArrDT < playerTimetableTrain.PreviousStop.arrivalDT ? Color.LightGreen : Color.LightSalmon;
271271
DateTime actDepDT = new DateTime((long)(Math.Pow(10, 7) * playerTimetableTrain.PreviousStop.ActualDepart));
272272
StationPreviousDepartActual.Text = actDepDT.ToString("HH:mm:ss");
273+
if (playerTimetableTrain.PreviousStop.AllowDepartEarly)
274+
{
275+
StationPreviousDepartActual.Text = actDepDT.ToString("HH*mm:ss");
276+
}
273277
StationPreviousDepartActual.Color = actDepDT > playerTimetableTrain.PreviousStop.arrivalDT ? Color.LightGreen : Color.LightSalmon;
274278
}
275279
else
@@ -314,6 +318,10 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
314318
StationCurrentArriveActual.Text = "";
315319
}
316320
StationCurrentDepartScheduled.Text = playerTimetableTrain.StationStops[0].departureDT.ToString("HH:mm:ss");
321+
if (playerTimetableTrain.StationStops[0].AllowDepartEarly)
322+
{
323+
StationCurrentDepartScheduled.Text = playerTimetableTrain.StationStops[0].departureDT.ToString("HH*mm:ss");
324+
}
317325
StationCurrentDistance.Text = FormatStrings.FormatDistanceDisplay(playerTimetableTrain.StationStops[0].DistanceToTrainM, metric);
318326
Message.Text = playerTimetableTrain.DisplayMessage;
319327
Message.Color = playerTimetableTrain.DisplayColor;
@@ -323,6 +331,10 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
323331
StationNextName.Text = playerTimetableTrain.StationStops[1].PlatformItem.Name;
324332
StationNextArriveScheduled.Text = playerTimetableTrain.StationStops[1].arrivalDT.ToString("HH:mm:ss");
325333
StationNextDepartScheduled.Text = playerTimetableTrain.StationStops[1].departureDT.ToString("HH:mm:ss");
334+
if (playerTimetableTrain.StationStops[1].AllowDepartEarly)
335+
{
336+
StationNextDepartScheduled.Text = playerTimetableTrain.StationStops[1].departureDT.ToString("HH*mm:ss");
337+
}
326338
StationNextDistance.Text = "";
327339
}
328340
else

0 commit comments

Comments
 (0)