Skip to content

Commit 1e37279

Browse files
committed
Temporary bug fix for https://bugs.launchpad.net/or/+bug/2004100 Casting error crash
1 parent 58e6767 commit 1e37279

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Source/RunActivity/Viewer3D/RollingStock/MSTSWagonViewer.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -737,14 +737,18 @@ private void UpdateAnimation(RenderFrame frame, ElapsedTime elapsedTime)
737737

738738
if (Car.BrakeSkid) // if car wheels are skidding because of brakes locking wheels up then stop wheels rotating.
739739
{
740-
if ( ((MSTSLocomotive)MSTSWagon).DriveWheelOnlyBrakes)
740+
// Temporary bug fix (CSantucci)
741+
if (MSTSWagon is MSTSLocomotive loco)
741742
{
742-
distanceTravelledDrivenM = 0.0f;
743-
}
744-
else
745-
{
746-
distanceTravelledM = 0.0f;
747-
distanceTravelledDrivenM = 0.0f;
743+
if (loco.DriveWheelOnlyBrakes)
744+
{
745+
distanceTravelledDrivenM = 0.0f;
746+
}
747+
else
748+
{
749+
distanceTravelledM = 0.0f;
750+
distanceTravelledDrivenM = 0.0f;
751+
}
748752
}
749753

750754
}

0 commit comments

Comments
 (0)