@@ -1326,7 +1326,9 @@ 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, bool allowdepartearly)
1329+ bool closeup, bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, bool allowdepartearly,
1330+ int? passTime = null, DateTime? passDT = null)
1331+
13301332 {
13311333 int platformIndex;
13321334 int activeSubroute = 0;
@@ -1374,24 +1376,25 @@ public StationStop CalculateStationStop(int platformStartID, int? arrivalTime, i
13741376 return null;
13751377 }
13761378
1377- // Determine end stop position depending on direction
1378- StationStop dummyStop = CalculateStationStopPosition(thisRoute, routeIndex, thisPlatform, activeSubroute,
1379- keepClearFront, keepClearRear, forcePosition, closeupSignal, closeup, restrictPlatformToSignal, extendPlatformToSignal,
1380- terminal, platformIndex);
1379+ StationStop thisStation;
1380+
1381+ // Determine pass time
1382+ // determine end stop position depending on direction
13811383
1382- // Build and add station stop
1383- StationStop thisStation = new StationStop(
1384+ if (passTime.HasValue)
1385+ {
1386+ thisStation = new StationStop(
13841387 platformStartID,
13851388 thisPlatform,
13861389 activeSubroute,
1387- dummyStop.RouteIndex ,
1388- dummyStop.TCSectionIndex ,
1389- dummyStop.Direction ,
1390- dummyStop.ExitSignal ,
1391- dummyStop.HoldSignal ,
1390+ routeIndex ,
1391+ sectionIndex ,
1392+ 0 ,
1393+ -1 ,
1394+ false ,
13921395 false,
13931396 false,
1394- dummyStop.StopOffset ,
1397+ 0 ,
13951398 arrivalTime,
13961399 departTime,
13971400 terminal,
@@ -1407,10 +1410,51 @@ public StationStop CalculateStationStop(int platformStartID, int? arrivalTime, i
14071410 allowdepartearly,
14081411 StationStop.STOPTYPE.STATION_STOP);
14091412
1410- if (arrivalDT.HasValue)
1413+ thisStation.PassTime = passTime.Value;
1414+ thisStation.passDT = passDT.Value;
1415+ thisStation.PassingOnly = true;
1416+ }
1417+ else
14111418 {
1412- thisStation.arrivalDT = arrivalDT.Value;
1413- thisStation.departureDT = departureDT.Value;
1419+
1420+ // Determine end stop position depending on direction
1421+ StationStop dummyStop = CalculateStationStopPosition(thisRoute, routeIndex, thisPlatform, activeSubroute,
1422+ keepClearFront, keepClearRear, forcePosition, closeupSignal, closeup, restrictPlatformToSignal, extendPlatformToSignal,
1423+ terminal, platformIndex);
1424+
1425+ // Build and add station stop
1426+ thisStation = new StationStop(
1427+ platformStartID,
1428+ thisPlatform,
1429+ activeSubroute,
1430+ dummyStop.RouteIndex,
1431+ dummyStop.TCSectionIndex,
1432+ dummyStop.Direction,
1433+ dummyStop.ExitSignal,
1434+ dummyStop.HoldSignal,
1435+ false,
1436+ false,
1437+ dummyStop.StopOffset,
1438+ arrivalTime,
1439+ departTime,
1440+ terminal,
1441+ actMinStopTime,
1442+ keepClearFront,
1443+ keepClearRear,
1444+ forcePosition,
1445+ closeupSignal,
1446+ closeup,
1447+ restrictPlatformToSignal,
1448+ extendPlatformToSignal,
1449+ endStop,
1450+ allowdepartearly,
1451+ StationStop.STOPTYPE.STATION_STOP);
1452+
1453+ if (arrivalDT.HasValue)
1454+ {
1455+ thisStation.arrivalDT = arrivalDT.Value;
1456+ thisStation.departureDT = departureDT.Value;
1457+ }
14141458 }
14151459
14161460 return thisStation;
@@ -2000,11 +2044,12 @@ public StationStop CalculateStationStopPosition(TCSubpathRoute thisRoute, int ro
20002044 /// <returns></returns>
20012045 public bool CreateStationStop(int platformStartID, int? arrivalTime, int? departTime, DateTime? arrivalDT, DateTime? departureDT, float clearingDistanceM,
20022046 float minStopDistanceM, bool terminal, int? actMinStopTime, float? keepClearFront, float? keepClearRear, bool forcePosition, bool closeupSignal,
2003- bool closeup, bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, bool allowdepartearly)
2047+ bool closeup, bool restrictPlatformToSignal, bool extendPlatformToSignal, bool endStop, bool allowdepartearly,
2048+ int? passTime = null, DateTime? passDT = null)
20042049 {
20052050 StationStop thisStation = CalculateStationStop(platformStartID, arrivalTime, departTime, arrivalDT, departureDT, clearingDistanceM,
20062051 minStopDistanceM, terminal, actMinStopTime, keepClearFront, keepClearRear, forcePosition, closeupSignal, closeup,
2007- restrictPlatformToSignal, extendPlatformToSignal, endStop, allowdepartearly);
2052+ restrictPlatformToSignal, extendPlatformToSignal, endStop, allowdepartearly, passTime, passDT );
20082053
20092054 if (thisStation != null)
20102055 {
@@ -2224,6 +2269,20 @@ public override void SetNextStationAction(bool fromAutopilotSwitch = false)
22242269 return;
22252270 }
22262271
2272+ // check if passing location only, remove for AI trains
2273+
2274+ while (thisStation.PassingOnly)
2275+ {
2276+ StationStops.RemoveAt(0);
2277+
2278+ if (StationStops.Count <= 0)
2279+ {
2280+ return;
2281+ }
2282+
2283+ thisStation = StationStops[0];
2284+ }
2285+
22272286 // Get distance to station, but not if just after switch to Autopilot and not during station stop
22282287 bool validStop = false;
22292288 while (!validStop)
@@ -4055,6 +4114,23 @@ public override void UpdateStationState(float elapsedClockSeconds, int presentTi
40554114 {
40564115 PreviousStop = StationStops[0].CreateCopy();
40574116 StationStops.RemoveAt(0);
4117+
4118+ if (StationStops.Count > 0)
4119+ {
4120+ thisStation = StationStops[0];
4121+
4122+ // check if next station is passing location only, if so remove
4123+
4124+ while (thisStation.PassingOnly)
4125+ {
4126+ StationStops.RemoveAt(0);
4127+ if (StationStops.Count <= 0)
4128+ {
4129+ break;
4130+ }
4131+ thisStation = StationStops[0];
4132+ }
4133+ }
40584134 }
40594135
40604136 ResetActions(true);
@@ -10200,14 +10276,15 @@ public void SetupStationStopHandling()
1020010276 /// </summary>
1020110277 public override void CheckStationTask()
1020210278 {
10279+ int presentTime = Convert.ToInt32(Math.Floor(Simulator.ClockTime));
10280+
1020310281 // If at station
1020410282 if (AtStation)
1020510283 {
1020610284 // Check for activation of other train
1020710285 ActivateTriggeredTrain(TriggerActivationType.StationStop, StationStops[0].PlatformReference);
1020810286
1020910287 // Get time
10210- int presentTime = Convert.ToInt32(Math.Floor(Simulator.ClockTime));
1021110288 int eightHundredHours = 8 * 3600;
1021210289 int sixteenHundredHours = 16 * 3600;
1021310290
@@ -10598,7 +10675,6 @@ public override void CheckStationTask()
1059810675 {
1059910676 MovementState = AI_MOVEMENT_STATE.STATION_STOP;
1060010677
10601- int presentTime = Convert.ToInt32(Math.Floor(Simulator.ClockTime));
1060210678 StationStops[0].ActualArrival = presentTime;
1060310679 StationStops[0].CalculateDepartTime(presentTime, this);
1060410680
@@ -10652,6 +10728,7 @@ public override void CheckStationTask()
1065210728
1065310729 // check if station missed : station must be at least 500m. behind us
1065410730 // also check if station was skipped as request stop
10731+ // also check if station was only passing point
1065510732 bool missedStation = false;
1065610733 int stationRouteIndex = ValidRoute[0].GetRouteIndex(StationStops[0].TCSectionIndex, 0);
1065710734
@@ -10682,6 +10759,36 @@ public override void CheckStationTask()
1068210759 }
1068310760 }
1068410761 }
10762+ else if (StationStops[0].PassingOnly)
10763+ {
10764+ bool passedstation = false;
10765+ if (StationStops[0].SubrouteIndex == TCRoute.activeSubpath)
10766+ {
10767+ if (stationRouteIndex < 0)
10768+ {
10769+ passedstation = true;
10770+ }
10771+ else if (stationRouteIndex == PresentPosition[1].RouteListIndex)
10772+ {
10773+ if ((PresentPosition[1].TCOffset - StationStops[0].StopOffset) > 50.0f)
10774+ {
10775+ passedstation = true;
10776+ }
10777+ }
10778+ else if (stationRouteIndex < PresentPosition[1].RouteListIndex)
10779+ {
10780+ passedstation = true;
10781+ }
10782+ }
10783+
10784+ if (passedstation)
10785+ {
10786+ StationStops[0].Passed = true;
10787+ StationStops[0].ActualDepart = presentTime;
10788+ PreviousStop = StationStops[0].CreateCopy();
10789+ StationStops.RemoveAt(0);
10790+ }
10791+ }
1068510792 else
1068610793 {
1068710794 if (StationStops[0].SubrouteIndex == TCRoute.activeSubpath)
0 commit comments