Skip to content

Commit c40f426

Browse files
committed
Automatic merge of T1.5.1-1808-gf2bc634a3 and 12 pull requests
- Pull request #570 at 362e4e7: glTF 2.0 support with PBR lighting - Pull request #1062 at 1ec3dc6: Train Forces popup Window. - Pull request #1064 at 1be1fc4: Add Train Info tab to Help window (F1) - Pull request #1067 at b471b7c: Traction and dynamic brake retardation - Pull request #1084 at 13454ed: Timetable: Calculate Delay While Stopped at a Station - Pull request #1074 at e9a66c1: Gradient - commit 2024-16-12 - Pull request #1085 at 37e2817: updates key commands for Train Operations window and also Daylight Offset - Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1087 at 1f64f02: Improve warning message for signal location mismatch. - Pull request #1088 at 4b3fa4c: Preserve previous log file. - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1081 at 689494b: Brake cuts power unification
14 parents c528ba6 + f2bc634 + 362e4e7 + 1ec3dc6 + 1be1fc4 + b471b7c + 13454ed + e9a66c1 + 37e2817 + e10390b + 1f64f02 + 4b3fa4c + 5845a1a + 689494b commit c40f426

File tree

14 files changed

+92
-1208
lines changed

14 files changed

+92
-1208
lines changed

Source/Orts.Formats.Msts/SignalConfigurationFile.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -582,15 +582,8 @@ public class SignalType
582582
public int NumClearAhead_ORTS { get; private set; }
583583
/// <summary>Number of seconds to spend animating a semaphore signal.</summary>
584584
public float SemaphoreInfo { get; private set; }
585-
586-
/// <summary> approach control details
587585
public ApproachControlLimits ApproachControlDetails;
588586

589-
/// <summary> visibility distance for request stop pick up
590-
public float? ReqStopVisDistance;
591-
/// <summary> announce distance for request stop set down
592-
public float? ReqStopAnnDistance;
593-
594587
/// <summary> Glow value for daytime (optional).</summary>
595588
public float? DayGlow = null;
596589
/// <summary> Glow value for nighttime (optional).</summary>
@@ -647,8 +640,6 @@ public SignalType(STFReader stf, bool ortsMode, IDictionary<string, SignalFuncti
647640
new STFReader.TokenProcessor("signaldrawstates", ()=>{ DrawStates = ReadDrawStates(stf); }),
648641
new STFReader.TokenProcessor("signalaspects", ()=>{ Aspects = ReadAspects(stf); }),
649642
new STFReader.TokenProcessor("approachcontrolsettings", ()=>{ ApproachControlDetails = ReadApproachControlDetails(stf); }),
650-
new STFReader.TokenProcessor("ortsreqstopvisdistance", ()=>{ReqStopVisDistance = stf.ReadFloatBlock(STFReader.UNITS.None, null); }),
651-
new STFReader.TokenProcessor("ortsreqstopanndistance", ()=>{ReqStopAnnDistance = stf.ReadFloatBlock(STFReader.UNITS.None, null); }),
652643
new STFReader.TokenProcessor("signalnumclearahead", ()=>{ numClearAhead = numClearAhead >= -1 ? numClearAhead : stf.ReadIntBlock(null); numdefs++;}),
653644
new STFReader.TokenProcessor("semaphoreinfo", ()=>{ SemaphoreInfo = stf.ReadFloatBlock(STFReader.UNITS.None, null); }),
654645
new STFReader.TokenProcessor("ortsdayglow", ()=>{ DayGlow = stf.ReadFloatBlock(STFReader.UNITS.None, null); }),

Source/Orts.Formats.Msts/SignalScripts.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public enum SCRExternalFunctions
113113
NEXT_SIG_HASNORMALSUBTYPE,
114114
ID_SIG_HASNORMALSUBTYPE,
115115
SWITCHSTAND,
116-
TRAIN_HAS_REQUEST_STOP,
117116
DEBUG_HEADER,
118117
DEBUG_OUT,
119118
RETURN,

Source/Orts.Simulation/Common/Events.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,6 @@ public enum Event
288288
CruiseControlAlert,
289289
CruiseControlAlert1,
290290

291-
// request stop
292-
RequestStopAnnounce,
293-
294291
MPCChangePosition,
295292

296293
}
@@ -569,8 +566,6 @@ public static Event From(Source source, int eventID)
569566
case 262: return Event.WindowsClosed;
570567
case 263: return Event.WindowsOpen;
571568

572-
case 270: return Event.RequestStopAnnounce;
573-
574569
// Cruise Control
575570
case 298: return Event.LeverFromZero;
576571
case 299: return Event.LeverToZero;

Source/Orts.Simulation/Simulation/AIs/AITrain.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,10 +1994,7 @@ public virtual void UpdateStationState(float elapsedClockSeconds, int presentTim
19941994

19951995
// Depart
19961996
thisStation.Passed = true;
1997-
if (thisStation.ArrivalTime >= 0)
1998-
{
19991997
Delay = TimeSpan.FromSeconds((presentTime - thisStation.DepartTime) % (24 * 3600));
2000-
}
20011998
PreviousStop = thisStation.CreateCopy();
20021999

20032000
if (thisStation.ActualStopType == StationStop.STOPTYPE.STATION_STOP
@@ -2063,6 +2060,7 @@ public virtual void UpdateStationState(float elapsedClockSeconds, int presentTim
20632060
MovementState = AI_MOVEMENT_STATE.STOPPED_EXISTING;
20642061
if (TrainType != TRAINTYPE.AI_PLAYERHOSTING) AtStation = false;
20652062
}
2063+
20662064
Delay = TimeSpan.FromSeconds((presentTime - thisStation.DepartTime) % (24 * 3600));
20672065
}
20682066
if (Cars[0] is MSTSLocomotive) Cars[0].SignalEvent(Event.AITrainLeavingStation);

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

Lines changed: 14 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3058,6 +3058,13 @@ public virtual bool PostInit()
30583058
if (IsActualPlayerTrain)
30593059
{
30603060
SetTrainSpeedLoggingFlag();
3061+
3062+
3063+
// if debug, print out all passing paths
3064+
3065+
#if DEBUG_DEADLOCK
3066+
Printout_PassingPaths();
3067+
#endif
30613068
}
30623069

30633070
return (validPosition);
@@ -13440,7 +13447,6 @@ public bool CreateStationStop(int platformStartID, int arrivalTime, int departTi
1344013447
false,
1344113448
false,
1344213449
false,
13443-
false,
1344413450
StationStop.STOPTYPE.STATION_STOP);
1344513451

1344613452
thisStation.arrivalDT = arrivalDT;
@@ -16326,7 +16332,6 @@ public StationStop CalculateStationStop(int platformStartID, int arrivalTime, in
1632616332
false,
1632716333
false,
1632816334
false,
16329-
false,
1633016335
StationStop.STOPTYPE.STATION_STOP);
1633116336

1633216337
thisStation.arrivalDT = arrivalDT;
@@ -20827,14 +20832,9 @@ public enum STOPTYPE
2082720832
public bool RestrictPlatformToSignal = false; // restrict end of platform to signal position
2082820833
public bool ExtendPlatformToSignal = false; // extend end of platform to next signal position
2082920834
public bool EndStop = false; // train terminates at station
20830-
public bool AllowDepartEarly = false; // train is allowed to depart early
2083120835
public List<int> ConnectionsWaiting = new List<int>(); // List of trains waiting
2083220836
public Dictionary<int, int> ConnectionsAwaited = new Dictionary<int, int>(); // List of awaited trains : key = trainno., value = arr time
2083320837
public Dictionary<int, WaitInfo> ConnectionDetails = new Dictionary<int, WaitInfo>(); // Details of connection : key = trainno., value = wait info
20834-
public RequestStop ReqStopDetails = null; // Request stop details
20835-
public int PassTime; // Passing time (int)
20836-
public DateTime passDT; // Passing time (DateTime)
20837-
public bool PassingOnly;
2083820838

2083920839
//================================================================================================//
2084020840
//
@@ -20843,9 +20843,9 @@ public enum STOPTYPE
2084320843

2084420844
public StationStop(int platformReference, PlatformDetails platformItem, int subrouteIndex, int routeIndex,
2084520845
int tcSectionIndex, int direction, int exitSignal, bool holdSignal, bool noWaitSignal, bool noClaimAllowed, float stopOffset,
20846-
int? arrivalTime, int? departTime, bool terminal, int? actualMinStopTime, float? keepClearFront, float? keepClearRear,
20846+
int arrivalTime, int departTime, bool terminal, int? actualMinStopTime, float? keepClearFront, float? keepClearRear,
2084720847
bool forcePosition, bool closeupSignal, bool closeup,
20848-
bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, bool allowdepartearly, STOPTYPE actualStopType)
20848+
bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, STOPTYPE actualStopType)
2084920849
{
2085020850
ActualStopType = actualStopType;
2085120851
PlatformReference = platformReference;
@@ -20861,21 +20861,14 @@ public StationStop(int platformReference, PlatformDetails platformItem, int subr
2086120861
StopOffset = stopOffset;
2086220862
if (actualStopType == STOPTYPE.STATION_STOP)
2086320863
{
20864-
if (arrivalTime.HasValue)
20865-
{
20866-
ArrivalTime = Math.Max(0, arrivalTime.Value);
20867-
DepartTime = Math.Max(0, departTime.Value);
20868-
}
20869-
else
20870-
{
20871-
ArrivalTime = DepartTime = -1;
20872-
}
20864+
ArrivalTime = Math.Max(0, arrivalTime);
20865+
DepartTime = Math.Max(0, departTime);
2087320866
}
2087420867
else
2087520868
// times may be <0 for waiting point
2087620869
{
20877-
ArrivalTime = arrivalTime.Value;
20878-
DepartTime = departTime.Value;
20870+
ArrivalTime = arrivalTime;
20871+
DepartTime = departTime;
2087920872
}
2088020873
ActualArrival = -1;
2088120874
ActualDepart = -1;
@@ -20892,10 +20885,8 @@ public StationStop(int platformReference, PlatformDetails platformItem, int subr
2089220885
RestrictPlatformToSignal = restrictPlatformToSignal;
2089320886
ExtendPlatformToSignal = extendPlatformToSignal;
2089420887
EndStop = endStop;
20895-
AllowDepartEarly = allowdepartearly;
2089620888

2089720889
CallOnAllowed = false;
20898-
PassingOnly = false;
2089920890
}
2090020891

2090120892
//================================================================================================//
@@ -21008,16 +20999,6 @@ public StationStop(BinaryReader inf, Signals signalRef)
2100820999
RestrictPlatformToSignal = inf.ReadBoolean();
2100921000
ExtendPlatformToSignal = inf.ReadBoolean();
2101021001
EndStop = inf.ReadBoolean();
21011-
AllowDepartEarly = inf.ReadBoolean();
21012-
21013-
if (inf.ReadBoolean())
21014-
{
21015-
ReqStopDetails = new RequestStop(inf, signalRef);
21016-
}
21017-
21018-
PassTime = inf.ReadInt32();
21019-
passDT = new DateTime(inf.ReadInt64());
21020-
PassingOnly = inf.ReadBoolean();
2102121002
}
2102221003

2102321004
//================================================================================================//
@@ -21141,21 +21122,6 @@ public void Save(BinaryWriter outf)
2114121122
outf.Write(RestrictPlatformToSignal);
2114221123
outf.Write(ExtendPlatformToSignal);
2114321124
outf.Write(EndStop);
21144-
outf.Write(AllowDepartEarly);
21145-
21146-
if (ReqStopDetails != null)
21147-
{
21148-
outf.Write(true);
21149-
ReqStopDetails.Save(outf);
21150-
}
21151-
else
21152-
{
21153-
outf.Write(false);
21154-
}
21155-
21156-
outf.Write(PassTime);
21157-
outf.Write((Int64)passDT.Ticks);
21158-
outf.Write(PassingOnly);
2115921125
}
2116021126

2116121127
/// <summary>
@@ -21178,21 +21144,6 @@ public int CalculateDepartTime(int presentTime, Train stoppedTrain)
2117821144
int eightHundredHours = 8 * 3600;
2117921145
int sixteenHundredHours = 16 * 3600;
2118021146

21181-
int stopTime = 0;
21182-
21183-
// allow to depart early if set (timetable mode only, so no need to check for valid schedule)
21184-
// also allow to depart after boarding time if arrival time is not set
21185-
if (AllowDepartEarly || ArrivalTime < 0)
21186-
{
21187-
stoppedTrain.ComputeTrainBoardingTime(this, ref stopTime);
21188-
ActualDepart = ActualArrival + stopTime;
21189-
21190-
// correct for times around midnight
21191-
if (ActualDepart > 24 * 3600) ActualDepart -= 24 * 3600;
21192-
if (DepartTime == 0) DepartTime = ActualDepart;
21193-
return stopTime;
21194-
}
21195-
2119621147
// preset depart to booked time
2119721148
ActualDepart = DepartTime;
2119821149

@@ -21207,7 +21158,7 @@ public int CalculateDepartTime(int presentTime, Train stoppedTrain)
2120721158
}
2120821159

2120921160
// correct stop time for stop around midnight
21210-
stopTime = DepartTime - ArrivalTime;
21161+
int stopTime = DepartTime - ArrivalTime;
2121121162
if (DepartTime < eightHundredHours && ArrivalTime > sixteenHundredHours) // stop over midnight
2121221163
{
2121321164
stopTime += (24 * 3600);

Source/Orts.Simulation/Simulation/Signalling/SIGSCRfile.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,18 +1440,6 @@ public int SH_function_value(SignalHead thisHead, SignalScripts.SCRScripts.SCRSt
14401440
return_value = thisHead.id_sig_hasnormalsubtype(parameter1_value, parameter2_value);
14411441
break;
14421442

1443-
// request stop
1444-
1445-
case SignalScripts.SCRExternalFunctions.TRAIN_HAS_REQUEST_STOP:
1446-
#if DEBUG_PRINT_PROCESS
1447-
if (TDB_debug_ref.Contains(thisHead.TDBIndex) || OBJ_debug_ref.Contains(thisHead.mainSignal.thisRef))
1448-
{
1449-
dumpfile = String.Concat(dpr_fileLoc, "printproc.txt");
1450-
}
1451-
#endif
1452-
return_value = thisHead.trainRequestStop(parameter1_value, parameter2_value, dumpfile);
1453-
break;
1454-
14551443
// switchstand
14561444

14571445
case SignalScripts.SCRExternalFunctions.SWITCHSTAND:

Source/Orts.Simulation/Simulation/Signalling/SignalHead.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ public class SignalHead
5050
public float? ApproachControlLimitPositionM;
5151
public float? ApproachControlLimitSpeedMpS;
5252

53-
public float? ReqStopVisDistance; // visibility for request stop for AI trains
54-
public float? ReqStopAnnDistance; // announce distance for request stop for player train
55-
5653
public SignalFunction Function { get; protected set; } = SignalFunction.UNKNOWN;
5754

5855
public int ORTSNormalSubtypeIndex; // subtype index form sigcfg file
@@ -158,11 +155,6 @@ public void SetSignalType(TrItem[] TrItems, SignalConfigurationFile sigCFG)
158155
ApproachControlLimitPositionM = null;
159156
ApproachControlLimitSpeedMpS = null;
160157
}
161-
162-
// request stop visibility
163-
164-
ReqStopVisDistance = signalType.ReqStopVisDistance;
165-
ReqStopAnnDistance = signalType.ReqStopAnnDistance;
166158
}
167159
else
168160
{
@@ -321,11 +313,6 @@ public int id_sig_hasnormalsubtype(int sigId, int reqSubtype)
321313
return 0;
322314
}
323315

324-
public int trainRequestStop(int aspect1, int aspect2, string dumpfile)
325-
{
326-
return mainSignal.trainRequestStop(aspect1, aspect2, dumpfile);
327-
}
328-
329316
public int switchstand(int aspect1, int aspect2, string dumpfile)
330317
{
331318
return mainSignal.switchstand(aspect1, aspect2, dumpfile);

Source/Orts.Simulation/Simulation/Signalling/SignalObject.cs

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ public enum Permission
8787

8888
public List<int> JunctionsPassed = new List<int>(); // Junctions which are passed checking next signal //
8989

90-
public int? platformRef = null; // platform reference, used for request stop
91-
public float? visDistance = null; // visibility distance for request stop
92-
9390
public int thisRef; // This signal's reference.
9491
public int direction; // Direction facing on track
9592

@@ -368,30 +365,6 @@ public void RestoreTrains(List<Train> trains)
368365
{
369366
enabledTrain = thisSection.CircuitState.TrainReserved;
370367
}
371-
else if (thisSection.CircuitState.HasTrainsOccupying())
372-
{
373-
List<Train.TrainRouted> trainList = thisSection.CircuitState.TrainsOccupying();
374-
float? offsetInSection = null;
375-
376-
foreach (var thisRouted in trainList)
377-
{
378-
var thisTrain = thisRouted.Train;
379-
var thisOffset = thisTrain.PresentPosition[0].TCOffset;
380-
if (!offsetInSection.HasValue || thisOffset > offsetInSection)
381-
{
382-
offsetInSection = thisOffset;
383-
if (thisTrain.Number == number)
384-
{
385-
enabledTrain = thisRouted;
386-
thisTrain.NextSignalObject[0] = this;
387-
}
388-
else
389-
{
390-
enabledTrain = null;
391-
}
392-
}
393-
}
394-
}
395368
else
396369
{
397370
enabledTrain = null; // reset - train not found
@@ -1278,67 +1251,6 @@ public int switchstand(int aspect1, int aspect2, string dumpfile)
12781251
}
12791252

12801253

1281-
/// <summary>
1282-
/// trainhasrequeststop : link signal with platform and set state according to request stop pickup requirements
1283-
/// </summary>
1284-
public int trainRequestStop(int aspect1, int aspect2, string dumpfile)
1285-
{
1286-
int aspect = 0;
1287-
1288-
// set platform link if not yet set
1289-
if (!platformRef.HasValue)
1290-
{
1291-
TrackCircuitSection thisSection = signalRef.TrackCircuitList[TCReference];
1292-
foreach (int pfIndex in thisSection.PlatformIndex)
1293-
{
1294-
PlatformDetails thisPlatform = signalRef.PlatformDetailsList[pfIndex];
1295-
if (thisPlatform.TCOffset[0, TCDirection] < TCOffset && TCOffset < thisPlatform.TCOffset[1, TCDirection])
1296-
{
1297-
platformRef = pfIndex;
1298-
continue;
1299-
}
1300-
else if (thisPlatform.TCOffset[1, TCDirection] < TCOffset && TCOffset < thisPlatform.TCOffset[0, TCDirection])
1301-
{
1302-
platformRef = pfIndex;
1303-
continue;
1304-
}
1305-
}
1306-
}
1307-
1308-
// if enabled, check if related station is next station for train
1309-
1310-
if (enabled && platformRef.HasValue)
1311-
{
1312-
if (enabledTrain.Train.StationStops != null && enabledTrain.Train.StationStops.Count > 0)
1313-
{
1314-
if (enabledTrain.Train.StationStops[0].PlatformItem.Name == signalRef.PlatformDetailsList[platformRef.Value].Name)
1315-
{
1316-
if (enabledTrain.Train.StationStops[0].ReqStopDetails != null)
1317-
{
1318-
foreach (var sighead in SignalHeads)
1319-
{
1320-
if (sighead.ReqStopVisDistance.HasValue)
1321-
{
1322-
enabledTrain.Train.StationStops[0].ReqStopDetails.visDistance = sighead.ReqStopVisDistance.Value;
1323-
}
1324-
if (sighead.ReqStopAnnDistance.HasValue)
1325-
{
1326-
enabledTrain.Train.StationStops[0].ReqStopDetails.annDistance = sighead.ReqStopAnnDistance.Value;
1327-
}
1328-
}
1329-
1330-
if (enabledTrain.Train.StationStops[0].ReqStopDetails.pickupSet)
1331-
{
1332-
aspect = 1;
1333-
}
1334-
}
1335-
}
1336-
}
1337-
}
1338-
1339-
return aspect;
1340-
}
1341-
13421254
/// <summary>
13431255
/// route_set : check if required route is set
13441256
/// </summary>

0 commit comments

Comments
 (0)