Skip to content

Commit 3047d0a

Browse files
authored
Merge pull request #798 from Csantucci/fix-casting-error
Temporary bug fix for https://bugs.launchpad.net/or/+bug/2004100 Casting error crash
2 parents 4903ade + 4b6141d commit 3047d0a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Source/RunActivity/Viewer3D/RollingStock/MSTSWagonViewer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,8 @@ 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 && loco.DriveWheelOnlyBrakes)
741742
{
742743
distanceTravelledDrivenM = 0.0f;
743744
}
@@ -746,7 +747,6 @@ private void UpdateAnimation(RenderFrame frame, ElapsedTime elapsedTime)
746747
distanceTravelledM = 0.0f;
747748
distanceTravelledDrivenM = 0.0f;
748749
}
749-
750750
}
751751

752752
// Running gear and drive wheel rotation (animation) in steam locomotives

0 commit comments

Comments
 (0)