if (Car.BrakeSkid) // if car wheels are skidding because of brakes locking wheels up then stop wheels rotating. { if ( ((MSTSLocomotive)MSTSWagon).DriveWheelOnlyBrakes) { distanceTravelledDrivenM = 0.0f; } else { distanceTravelledM = 0.0f; distanceTravelledDrivenM = 0.0f; } }
If MSTSWagon is a wagon and not a locomotive, the casting to MSTSLocomotive fails. I've temporarily generated a fix for ORNYMG, while I'd suggest that the author of this part of code analyzes the issue and solves it for the official releases.