Skip to content

Commit a34b857

Browse files
committed
Fix bug in interpreting presence of a rear 3D cab
1 parent fe901d3 commit a34b857

File tree

1 file changed

+3
-2
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks

1 file changed

+3
-2
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,8 +2275,9 @@ public bool HasRear3DCab
22752275
{
22762276
var loco = this as MSTSLocomotive;
22772277
var i = (int)CabViewType.Rear;
2278-
if (loco == null || loco.CabView3D == null) return false;
2279-
return (loco.CabView3D.ViewPointList.Count > i);
2278+
if (loco == null || loco.CabView3D == null || loco.CabView3D.ViewPointList.Count <= i) return false;
2279+
var cabViewAngle = loco.CabView3D.ViewPointList[i].StartDirection.Y;
2280+
return ((cabViewAngle >= 90 && cabViewAngle <= 270) || (cabViewAngle <= -90 && cabViewAngle >= -270));
22802281
}
22812282
}
22822283

0 commit comments

Comments
 (0)