We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e949c3 commit ff5688fCopy full SHA for ff5688f
Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs
@@ -3131,7 +3131,10 @@ void UpdatePositionFlags()
3131
foreach (var troughs in section.TroughInfo)
3132
{
3133
var trough = troughs[currentPin.Direction];
3134
- if (checkedM + trough.TroughStart <= frontOffsetM && rearOffsetM <= checkedM + trough.TroughEnd) isOverTrough = true;
+ // Start and end are -1 if the trough extends beyond this section
3135
+ var troughStart = trough.TroughStart < 0 ? 0 : trough.TroughStart;
3136
+ var troughEnd = trough.TroughEnd < 0 ? section.Length : trough.TroughEnd;
3137
+ if (checkedM + troughStart <= frontOffsetM && rearOffsetM <= checkedM + troughEnd) isOverTrough = true;
3138
}
3139
3140
0 commit comments