Skip to content

Commit

Permalink
Temporary bug fix for https://bugs.launchpad.net/or/+bug/2004100 Cast…
Browse files Browse the repository at this point in the history
…ing error crash
  • Loading branch information
Csantucci committed Jan 29, 2023
1 parent 58e6767 commit 1e37279
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Source/RunActivity/Viewer3D/RollingStock/MSTSWagonViewer.cs
Expand Up @@ -737,14 +737,18 @@ private void UpdateAnimation(RenderFrame frame, ElapsedTime elapsedTime)

if (Car.BrakeSkid) // if car wheels are skidding because of brakes locking wheels up then stop wheels rotating.
{
if ( ((MSTSLocomotive)MSTSWagon).DriveWheelOnlyBrakes)
// Temporary bug fix (CSantucci)
if (MSTSWagon is MSTSLocomotive loco)
{
distanceTravelledDrivenM = 0.0f;
}
else
{
distanceTravelledM = 0.0f;
distanceTravelledDrivenM = 0.0f;
if (loco.DriveWheelOnlyBrakes)
{
distanceTravelledDrivenM = 0.0f;
}
else
{
distanceTravelledM = 0.0f;
distanceTravelledDrivenM = 0.0f;
}
}

}
Expand Down

0 comments on commit 1e37279

Please sign in to comment.