File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Source/RunActivity/Viewer3D Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -426,29 +426,44 @@ public bool CheckIfOnSwitch()
426426
427427 if ( Car . Train . PresentPosition [ 0 ] . TCSectionIndex != Car . Train . PresentPosition [ 1 ] . TCSectionIndex )
428428 {
429+ // Trace.TraceInformation("Track Type#1 {0}", Car.Train.PresentPosition[1].TCSectionIndex);
429430 try
430431 {
431432 var copyOccupiedTrack = Car . Train . OccupiedTrack . ToArray ( ) ;
432433 foreach ( var thisSection in copyOccupiedTrack )
433434 {
434- if ( thisSection . CircuitType == TrackCircuitSection . TrackCircuitType . Junction || thisSection . CircuitType == TrackCircuitSection . TrackCircuitType . Crossover )
435+ // Trace.TraceInformation("Track Type {0}", thisSection.CircuitType);
436+ // if (thisSection.CircuitType == TrackCircuitSection.TrackCircuitType.Junction || thisSection.CircuitType == TrackCircuitSection.TrackCircuitType.Crossover)
437+ if ( thisSection . CircuitType == TrackCircuitSection . TrackCircuitType . Junction )
435438 {
439+ // Trace.TraceInformation("Check Switch#0");
440+
436441 // train is on a switch; let's see if car is on a switch too
437442 WorldLocation switchLocation = UidLocation ( Viewer . Simulator . TDB . TrackDB . TrackNodes [ thisSection . OriginalIndex ] . UiD ) ;
438443 var distanceFromSwitch = WorldLocation . GetDistanceSquared ( Car . WorldPosition . WorldLocation , switchLocation ) ;
439444 if ( distanceFromSwitch < Car . CarLengthM * Car . CarLengthM + Math . Min ( Car . SpeedMpS * 3 , 150 ) )
440445 {
441446 CarOnSwitch = true ;
447+ // Trace.TraceInformation("Check Switch#1a");
442448 return CarOnSwitch ;
443449 }
444450 }
451+
452+ if ( thisSection . CircuitType == TrackCircuitSection . TrackCircuitType . Crossover )
453+ {
454+ CarOnSwitch = true ;
455+ // Trace.TraceInformation("Check Switch#1b");
456+ return CarOnSwitch ;
457+ }
445458 }
446459 }
447460 catch
448461 {
462+ // Trace.TraceInformation("Check Switch#2");
449463 return CarOnSwitch ;
450464 }
451465 }
466+ // Trace.TraceInformation("Check Switch#3");
452467 return CarOnSwitch ;
453468 }
454469
You can’t perform that action at this time.
0 commit comments